-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added password strength check + Tests (#918)
* Added password strength check + Tests Also changed automatically generated passwords to Password2 instead of Password1 * Fixed A Couple Of Things Small errors caught on code climate * Changed Password Reset Checks Student passwords (not automatically generated) now need to be at least 8 characters long. Also fixed 8 character condition (equal or greater than) * Changed Password Length Message On Test * Changed Password Error/Warning Message Instead of only pointing out length, it points out the password requirements whenever at least one isn't met * Restructured The Dynamic Update Function
- Loading branch information
1 parent
14bacb5
commit aa0caff
Showing
12 changed files
with
102 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,15 +64,21 @@ def test_signup_with_newsletter(self): | |
page, _, _, _, _ = create_independent_student(page, newsletter=True) | ||
assert is_email_verified_message_showing(self.selenium) | ||
|
||
def test_signup_failed(self): | ||
def test_signup_failure_short_password(self): | ||
page = self.go_to_homepage() | ||
page = submit_independent_student_signup_form(page, password='test') | ||
assert page.has_independent_student_signup_failed( | ||
'Password not strong enough, consider using at least 6 characters') | ||
'Password not strong enough, consider using at least 8 characters, upper and lower case letters, and numbers') | ||
|
||
def test_signup_failure_common_password(self): | ||
page = self.go_to_homepage() | ||
page = submit_independent_student_signup_form(page, password='Password1') | ||
assert page.has_independent_student_signup_failed( | ||
'Password not strong enough, consider using at least 8 characters, upper and lower case letters, and numbers') | ||
|
||
def test_signup_invalid_name(self): | ||
page = self.go_to_homepage().go_to_signup_page() | ||
page = page.independent_student_signup('Florian!', 'Florian', '[email protected]', 'Password1', 'Password1', | ||
page = page.independent_student_signup('Florian!', 'Florian', '[email protected]', 'Password2', 'Password2', | ||
success=False) | ||
|
||
assert self.is_signup_page(page) | ||
|
@@ -81,7 +87,7 @@ def test_signup_invalid_name(self): | |
|
||
def test_signup_invalid_username(self): | ||
page = self.go_to_homepage().go_to_signup_page() | ||
page = page.independent_student_signup('Florian', '///', '[email protected]', 'Password1', 'Password1', | ||
page = page.independent_student_signup('Florian', '///', '[email protected]', 'Password2', 'Password2', | ||
success=False) | ||
|
||
assert self.is_signup_page(page) | ||
|
@@ -92,15 +98,15 @@ def test_signup_username_already_in_use(self): | |
page = self.go_to_homepage() | ||
page, name, username, email, password = create_independent_student(page) | ||
page = self.go_to_homepage().go_to_signup_page() | ||
page = page.independent_student_signup('Florian', username, '[email protected]', 'Password1', 'Password1', | ||
page = page.independent_student_signup('Florian', username, '[email protected]', 'Password2', 'Password2', | ||
success=False) | ||
|
||
assert self.is_signup_page(page) | ||
assert page.has_independent_student_signup_failed('That username is already in use') | ||
|
||
def test_signup_password_do_not_match(self): | ||
page = self.go_to_homepage().go_to_signup_page() | ||
page = page.independent_student_signup('Florian', 'Florian', '[email protected]', 'Password1', 'Password2', | ||
page = page.independent_student_signup('Florian', 'Florian', '[email protected]', 'Password2', 'Password3', | ||
success=False) | ||
|
||
assert self.is_signup_page(page) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
|
||
def generate_school_details(): | ||
name = 'Student %d' % generate_school_details.next_id | ||
password = 'Password1' | ||
password = 'Password2' | ||
|
||
generate_school_details.next_id += 1 | ||
|
||
|
@@ -96,7 +96,7 @@ def generate_independent_student_details(): | |
name = 'Student %d' % generate_independent_student_details.next_id | ||
username = 'Student user %d' % generate_independent_student_details.next_id | ||
email_address = 'Student%[email protected]' % generate_independent_student_details.next_id | ||
password = 'Password1' | ||
password = 'Password2' | ||
|
||
generate_independent_student_details.next_id += 1 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,7 @@ def generate_details(**kwargs): | |
first_name = kwargs.get('first_name', 'Test') | ||
last_name = kwargs.get('last_name', 'Teacher') | ||
email_address = kwargs.get('email_address', 'testteacher%[email protected]' % random.randint(1, sys.maxint)) | ||
password = kwargs.get('password', 'Password1') | ||
password = kwargs.get('password', 'Password2') | ||
|
||
return title, first_name, last_name, email_address, password | ||
|
||
|
@@ -99,3 +99,14 @@ def signup_teacher(page, newsletter=False): | |
mail.outbox = [] | ||
|
||
return page, email_address, password | ||
|
||
|
||
def submit_teacher_signup_form(page, password='test'): | ||
page = page.go_to_signup_page() | ||
|
||
title, first_name, last_name, email_address, _ = generate_details() | ||
return page.signup(title, first_name, last_name, email_address, | ||
password=password, | ||
confirm_password=password, | ||
success=False, | ||
newsletter=True) |