Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor status code checks in API acceptance tests #37944

Closed
phil-davis opened this issue Sep 25, 2020 · 0 comments · Fixed by #37989
Closed

Refactor status code checks in API acceptance tests #37944

phil-davis opened this issue Sep 25, 2020 · 0 comments · Fixed by #37989

Comments

@phil-davis
Copy link
Contributor

Now that we have many sharing API acceptance tests with auto-accept off, we often get sequences like this:

    When user "Alice" shares folder "/FOLDER" with group "grp1" using the sharing API
    And user "Brian" accepts share "/FOLDER" offered by user "Alice" using the sharing API
    Then the OCS status code should be "<ocs_status_code>"
    And the HTTP status code should be "<http_status_code>"
    And the fields of the last response to user "Alice" should include
      | expiration |  |
    And the response when user "Brian" gets the info of the last share should include
      | expiration |  |

We need to do 2 When actions in order to get the share to be effectively useable by the share receiver.

We also want to be able to check the HTTP status code, OCS status code and response of the create-share request done by Alice. We could write scenarios in this style:

    When user "Alice" shares folder "/FOLDER" with group "grp1" using the sharing API
    Then the OCS status code should be "<ocs_status_code>"
    And the HTTP status code should be "<http_status_code>"
    And the fields of the last response to user "Alice" should include
      | expiration |  |
    When user "Brian" accepts share "/FOLDER" offered by user "Alice" using the sharing API
    Then the OCS status code should be "<ocs_status_code>"
    And the HTTP status code should be "<http_status_code>"
    And the response when user "Brian" gets the info of the last share should include
      | expiration |  |

Or we could design some way that the test code remembers the statuses and responses from many (all?) the previous steps and checks like Then the HTTP status code should be... have a way to refer to the response that they want to examine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant