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

#159054008 User Should Receive Descriptive Validation Errors. #10

Merged
merged 15 commits into from
Aug 3, 2018

Conversation

dessHub
Copy link

@dessHub dessHub commented Jul 31, 2018

What does this PR do?
. Implements descriptive validation error messages.

How To Manually Test?

  1. Pull ft-validators-159054008 branch.
    git pull origin ft-validators-159054008
  2. Checkout to ft-validators-159054008 branch
    git checkout ft-validators-159054008
  3. Start the server
    python manage.py runserver
  4. Test the endpoints on postman.

Affected Endpoints:
POST \api\users

{
  "user":{
    "username": "testuser",
    "email": "info",
    "password": "Pass123."
  }
}

RESPONSE
{
    "errors": {
        "email": [
            "Enter a valid email address."
        ]
    }
}

What are the relevant pivotal tracker stories?

#159054008 Users should receive descriptive signup/Registration validation errors

@coveralls
Copy link

coveralls commented Jul 31, 2018

Coverage Status

Coverage increased (+0.6%) to 96.444% when pulling be2cfa8 on ft-validators-159054008 into 51a64b0 on develop.

@@ -67,3 +67,44 @@ def test_username_cannot_be_register_twice(self):
errors = json.loads(response.content).get("errors")
self.assertEqual(errors['username'][0], "user with this username already exists.")
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)

def test_password_cannot_be_lass_than_8_characters(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix typo lass to less

self.assertEqual(errors['password'][0], "Password should be atleats 8 characters.")
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)

def test_password_Not_being_alphanumeric(self):
Copy link

@denniswanjiru denniswanjiru Aug 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should not capitalize words in snake_case naming convention

@jacksono
Copy link

jacksono commented Aug 1, 2018

@dessHub are you still making changes on this PR?

@dessHub
Copy link
Author

dessHub commented Aug 1, 2018

@jacksono Done updating the PR

@jacksono
Copy link

jacksono commented Aug 1, 2018

@dessHub from testing on my machine i have noticed that a user can register with a password is that not alphanumeric. In the example below, the password does not contain a number but the user gets registered
screen shot 2018-08-01 at 23 11 13
Also I have merged in a new PR so you need to pull the latest changes from develop into your branch.

@dessHub
Copy link
Author

dessHub commented Aug 2, 2018

@jacksono Will look into it right away.

@dessHub
Copy link
Author

dessHub commented Aug 2, 2018

@jacksono I have fixed the bug.

@Duncanian
Copy link

@dessHub , I tested it with a wrong email and got the correct error message. It works as expected

@jacksono jacksono merged commit 4e83794 into develop Aug 3, 2018
@jacksono jacksono deleted the ft-validators-159054008 branch August 3, 2018 07:02
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

Successfully merging this pull request may close these issues.

5 participants