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

Error message indistinguishable #132

Open
wytrych opened this issue Aug 18, 2015 · 7 comments
Open

Error message indistinguishable #132

wytrych opened this issue Aug 18, 2015 · 7 comments

Comments

@wytrych
Copy link

wytrych commented Aug 18, 2015

I'm trying to e2e test user registration and login.

When I try to log in with bad credentials I get back a 400 error with a text in non_field_errors Unable to log in with provided credentials.

When I try to log in with an unverified account I also get back a 400 error with a different non_field_errors User account is disabled.

The only way to distinguish between them is by the error text, which will break when the text changes or we change to a different language.

A possible solution would be to use a different error status or maybe add a field which describes error type in machine readable form.

@wytrych
Copy link
Author

wytrych commented Aug 18, 2015

@kevinetienne @meshy @Ian-Foote FYI

@meshy
Copy link
Contributor

meshy commented Aug 18, 2015

Why do you need to distinguish between them? Is a 400 not enough to confirm your expected result? What are you testing exactly?

@kevinetienne
Copy link
Contributor

It looks like we are already making the distinction between:

  • a bad password
  • an inactive account

Maybe the first one should return a 401?

@meshy
Copy link
Contributor

meshy commented Aug 18, 2015

@kevinetienne they are both bad requests. 400 is correct.

@wytrych
Copy link
Author

wytrych commented Aug 18, 2015

@meshy I wanted to test two cases:

  1. A user has created an account, enters their correct email and password, but the account isn't verified, so it will not let them in.
  2. A user enters bad credentials, so can't log in.

@LilyFoote
Copy link
Contributor

I think this might be trying to test too much in end-to-end tests.

@wytrych
Copy link
Author

wytrych commented Aug 18, 2015

Possibly.

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

4 participants