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

Validate profile form fields #4910

Merged
merged 6 commits into from
Dec 3, 2018
Merged

Validate profile form fields #4910

merged 6 commits into from
Dec 3, 2018

Conversation

dojutsu-user
Copy link
Member

Fixes #4887

@codecov
Copy link

codecov bot commented Nov 16, 2018

Codecov Report

Merging #4910 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #4910      +/-   ##
==========================================
+ Coverage   76.65%   76.66%   +<.01%     
==========================================
  Files         158      158              
  Lines       10057    10057              
  Branches     1269     1269              
==========================================
+ Hits         7709     7710       +1     
  Misses       2007     2007              
+ Partials      341      340       -1
Impacted Files Coverage Δ
readthedocs/core/forms.py 84.61% <100%> (ø) ⬆️
readthedocs/profiles/views.py 88.13% <0%> (+1.69%) ⬆️

readthedocs/core/forms.py Outdated Show resolved Hide resolved
@@ -35,23 +35,6 @@ def test_edit_profile(self):
self.assertEqual(self.user.last_name, 'Docs')
self.assertEqual(self.user.profile.homepage, 'readthedocs.org')

def test_edit_profile_with_invalid_values(self):
Copy link
Member

Choose a reason for hiding this comment

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

We should keep the tests

Copy link
Member Author

Choose a reason for hiding this comment

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

I have added the tests.
Just one doubt, max_length is already well-tested feature of django, then what was the need for the these tests ?

Copy link
Member

Choose a reason for hiding this comment

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

Just to be sure we don't break this in the future

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay...
Thanks..!!


self.assertTrue(len(long_first_name) > 30)
self.assertTrue(len(long_last_name) > 30)
self.assertTrue(len(long_homepage) > 100)
Copy link
Member

Choose a reason for hiding this comment

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

we could just use string multiplication to make the test shorter and more clear, 'a' * 31

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for guiding me on this.
I have made the changes.

Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for your contribution!

@humitos humitos merged commit 3800d75 into readthedocs:master Dec 3, 2018
@dojutsu-user dojutsu-user deleted the validate-profile-form-fields branch December 12, 2018 11:11
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.

3 participants