Coverage for bookie.tests.test_auth.test_reset : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
"""Test the password reset step process
- You've forgotten your password - You enter your email into the forgotten password ui - Your account gets a activation record - Your account is deactivated - An email with the activation url is emailed to you - You cannot re-enter the account for activation until the previous one is expired/or a successful reset has occurred - While the account is deactivated you cannot make api calls or view login-only urls - You follow the activation link and can reset your password - At this point you can log in with the new password - api and other calls now function
"""
"""Reset the admin account""" "UPDATE users SET activated='1' WHERE username='admin';")
"""Test bad call to reset""" '/api/v1/suspend', content_type='application/json', status=406) "Should not be successful with no email address: " + str(res))
params={'email': 'notexist@gmail.com'}, status=404) "Should not be successful with invalid email address: " + str(res))
""" Functional test to see if we can submit the api to reset an account
Now by doing this we end up marking the account deactivated which causes other tests to 403 it up. Need to reinstate the admin account on tearDown
""" params={'email': u'testing@dummy.com'}, status=200)
"Should be successful with admin email address: " + str(res))
"""Test that we can't resubmit for reset, get prompted to email
If we reset and then try to say "I've forgotten" a second time, we should get a nice message. And that message should allow us to get a second copy of the email sent.
""" params={'email': u'testing@dummy.com'}, status=200)
"Should be successful with admin email address")
params={'email': u'testing@dummy.com'}, status=406)
"Should not be successful on second try: " + str(res))
"Should find 'already' in the response: " + str(res))
"""Walk through all of the steps at a time
- First we mark that we've forgotten - Then use make sure we get a 403 accessing something - Then we go back through our activation using our code - Finally verify we can access the earlier item
""" params={'email': u'testing@dummy.com'}, status=200)
"Should be successful with admin email address")
# now let's try to login # the migrations add a default admin account 'password': 'admin', 'form.submitted': 'true'}
params=user_data, status=200)
"Login should have failed since we're not active: " + str(res))
"/api/v1/suspend?username={0}&code={1}&password={2}".format( user_data['login'], act.code, 'admin'), status=200)
"Should be prompted to login now: " + str(res))
'password': 'admin', 'form.submitted': 'true'}
params=user_data, status=302) |