forked from hedyorg/hedy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ask for programming experience on signup & profile (hedyorg#541)
* WIP, need to rework saved structure in DynamoDB & add e2e tests. * Update profile template. * Reorganize DynamoDB structure; add E2E tests & fix server bugs; show programming experience in profile. * Revert unnecessary changes. * Add missing texts. * Hide the language checkboxes if experience is not 'yes'; markup improvements. * translates new signup lines in Dutch Co-authored-by: Felienne <[email protected]>
- Loading branch information
Showing
21 changed files
with
216 additions
and
1,102 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
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 |
---|---|---|
|
@@ -123,16 +123,17 @@ def invalidMap (tag, method, path, bodies): | |
counter += 1 | ||
return output | ||
|
||
def successfulSignup (state, response, username): | ||
if not 'token' in response ['body']: | ||
raise Exception ('No token present') | ||
state ['token'] = response ['body'] ['token'] | ||
|
||
# We define apres functions here because multiline lambdas are not supported by python | ||
def setSentCookies (state, response, username): | ||
if 'Set-Cookie' in response ['headers']: | ||
state ['headers'] ['cookie'] = response ['headers'] ['Set-Cookie'] | ||
|
||
def successfulSignup (state, response, username): | ||
if not 'token' in response ['body']: | ||
raise Exception ('No token present') | ||
state ['token'] = response ['body'] ['token'] | ||
setSentCookies (state, response, username) | ||
|
||
def getProfile1 (state, response, username): | ||
profile = response ['body'] | ||
if profile ['username'] != username: | ||
|
@@ -162,6 +163,22 @@ def getProfile3 (state, response, username): | |
if 'verification_pending' in profile: | ||
raise Exception ('Invalid verification_pending (getProfile3)') | ||
|
||
def getProfile4 (state, response, username): | ||
profile = response ['body'] | ||
if not 'verification_pending' in profile or profile ['verification_pending'] != True: | ||
raise Exception ('Invalid verification_pending (getProfile4)') | ||
if not 'prog_experience' in profile or profile ['prog_experience'] != 'yes': | ||
raise Exception ('Invalid prog_experience (getProfile4)') | ||
if not 'experience_languages' in profile or not type_check (profile ['experience_languages'], 'list') or len (profile ['experience_languages']) != 1 or profile ['experience_languages'] [0] != 'python': | ||
raise Exception ('Invalid experience_languages (getProfile4)') | ||
|
||
def getProfile5 (state, response, username): | ||
profile = response ['body'] | ||
if not 'prog_experience' in profile or profile ['prog_experience'] != 'no': | ||
raise Exception ('Invalid prog_experience (getProfile5)') | ||
if not 'experience_languages' in profile or not type_check (profile ['experience_languages'], 'list') or len (profile ['experience_languages']) != 2 or profile ['experience_languages'] [0] not in ['scratch', 'other_text'] or profile ['experience_languages'] [1] not in ['scratch', 'other_text']: | ||
raise Exception ('Invalid experience_languages (getProfile5)') | ||
|
||
def emailChange (state, response, username): | ||
if not type_check (response ['body'] ['token'], 'str'): | ||
raise Exception ('Invalid country (emailChange)') | ||
|
@@ -239,7 +256,7 @@ def suite (username): | |
['get session vars from test', 'get', '/session_test', {}, {}, 200, checkTestSessionVars], | ||
['get session vars from main again', 'get', '/session_main', {}, {}, 200, checkMainSessionVarsAgain], | ||
['get root', 'get', '/', {}, '', 200], | ||
invalidMap ('signup', 'post', '/auth/signup', ['', [], {}, {'username': 1}, {'username': 'user@me', 'password': 'foobar', 'email': '[email protected]'}, {'username:': 'user: me', 'password': 'foobar', 'email': '[email protected]'}, {'username': 't'}, {'username': ' t '}, {'username': username}, {'username': username, 'password': 1}, {'username': username, 'password': 'foo'}, {'username': username, 'password': 'foobar'}, {'username': username, 'password': 'foobar', 'email': 'me@something'}]), | ||
invalidMap ('signup', 'post', '/auth/signup', ['', [], {}, {'username': 1}, {'username': 'user@me', 'password': 'foobar', 'email': '[email protected]'}, {'username:': 'user: me', 'password': 'foobar', 'email': '[email protected]'}, {'username': 't'}, {'username': ' t '}, {'username': username}, {'username': username, 'password': 1}, {'username': username, 'password': 'foo'}, {'username': username, 'password': 'foobar'}, {'username': username, 'password': 'foobar', 'email': 'me@something'}, {'username': username, 'password': 'foobar', 'email': '[email protected]', 'prog_experience': [2]}, {'username': username, 'password': 'foobar', 'email': '[email protected]', 'prog_experience': 'foo'}, {'username': username, 'password': 'foobar', 'email': '[email protected]', 'experience_languages': 'python'}]), | ||
['valid signup', 'post', '/auth/signup', {}, {'username': username, 'password': 'foobar', 'email': username + '@e2e-testing.com'}, 200, successfulSignup], | ||
invalidMap ('login', 'post', '/auth/login', ['', [], {}, {'username': 1}, {'username': 'user@me'}, {'username:': 'user: me'}]), | ||
['valid login, invalid credentials', 'post', '/auth/login', {}, {'username': username, 'password': 'password'}, 403], | ||
|
@@ -257,7 +274,7 @@ def suite (username): | |
['login again', 'post', '/auth/login', {}, {'username': username, 'password': 'foobar2'}, 200, setSentCookies], | ||
invalidMap ('change password', 'post', '/auth/change_password', ['', [], {}, {'foo': 'bar'}, {'old_password': 1}, {'old_password': 'foobar'}, {'old_password': 'foobar', 'new_password': 1}]), | ||
['get profile before profile update', 'get', '/profile', {}, {}, 200, getProfile1], | ||
invalidMap ('update profile', 'post', '/profile', ['', [], {'email': 'foobar'}, {'birth_year': 'a'}, {'birth_year': 20}, {'country': 'Netherlands'}, {'gender': 0}, {'gender': 'a'}]), | ||
invalidMap ('update profile', 'post', '/profile', ['', [], {'email': 'foobar'}, {'birth_year': 'a'}, {'birth_year': 20}, {'country': 'Netherlands'}, {'gender': 0}, {'gender': 'a'}, {'prog_experience': 1}, {'prog_experience': 'foo'}, {'experience_languages': ['python', 'foo']}]), | ||
['change profile with same email', 'post', '/profile', {}, {'email': username + '@e2e-testing.com', 'country': 'US'}, 200], | ||
['change profile with different email', 'post', '/profile', {}, {'email': username + '@e2e-testing2.com', 'country': 'NL'}, 200, emailChange], | ||
['get profile after profile update', 'get', '/profile', {}, {}, 200, getProfile2], | ||
|
@@ -280,7 +297,12 @@ def suite (username): | |
['delete program', 'get', lambda state: '/programs/delete/' + state ['program'] ['id'], {}, {}, 302], | ||
['retrieve programs after deleting saved program', 'get', '/programs_list', {}, {}, 200, retrieveProgramsBefore], | ||
['destroy account', 'post', '/auth/destroy', {}, {}, 200], | ||
['get programs without being logged in', 'get', '/programs', {}, {}, 302] | ||
['get programs without being logged in', 'get', '/programs', {}, {}, 302], | ||
['valid signup again', 'post', '/auth/signup', {}, {'username': username, 'password': 'foobar', 'email': username + '@e2e-testing.com', 'prog_experience': 'yes', 'experience_languages': ['python']}, 200, successfulSignup], | ||
['get profile after recreating account', 'get', '/profile', {}, {}, 200, getProfile4], | ||
['change profile with different programming experience', 'post', '/profile', {}, {'prog_experience': 'no', 'experience_languages': ['scratch', 'other_text']}, 200], | ||
['get profile after updating experience', 'get', '/profile', {}, {}, 200, getProfile5], | ||
['destroy account', 'post', '/auth/destroy', {}, {}, 200], | ||
] | ||
|
||
if not args.concurrent: | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
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
Oops, something went wrong.