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

Support many states api responses #57

Open
nvduc2910 opened this issue Aug 6, 2020 · 0 comments
Open

Support many states api responses #57

nvduc2910 opened this issue Aug 6, 2020 · 0 comments

Comments

@nvduc2910
Copy link

nvduc2910 commented Aug 6, 2020

Hello.

Is there any way to support many states API responses such as:

  • Call Login success will be responded:
router["/api/v2/login"] = DelayResponse(JSONStringResponse(handler: { _ -> Any in
    return """
        {
          "acess_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
        }
    """
}))
  • Call login failed will be responded:
router["/api/v2/login"] = DelayResponse(JSONStringResponse(handler: { _ -> Any in
    return """
        {
          "message": "incorrect password"
        }
    """
}))

I mean I want to test a feature (login) with many cases as many API responses. Seem to now only one state can setup before a test.

Thank you so much.

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

No branches or pull requests

1 participant