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

Conversation

@dojutsu-user
Copy link
Member

@dojutsu-user dojutsu-user commented Nov 16, 2018

Fixes #4887

@codecov
Copy link

@codecov 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

@stsewd stsewd Nov 18, 2018

We should keep the tests

Copy link
Member Author

@dojutsu-user dojutsu-user Nov 18, 2018

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

@stsewd stsewd Nov 18, 2018

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

Copy link
Member Author

@dojutsu-user dojutsu-user Nov 18, 2018

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

@stsewd stsewd Nov 18, 2018

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

Copy link
Member Author

@dojutsu-user dojutsu-user Nov 18, 2018

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

stsewd
stsewd approved these changes Nov 18, 2018
humitos
humitos approved these changes Dec 3, 2018
Copy link
Member

@humitos humitos left a comment

Looks good! Thanks for your contribution!

@humitos humitos merged commit 3800d75 into readthedocs:master Dec 3, 2018
3 checks passed
@dojutsu-user dojutsu-user deleted the validate-profile-form-fields branch Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants