mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-23 08:22:15 +00:00
Fixed registration test
This commit is contained in:
@@ -101,16 +101,16 @@ class UserRegistrationTest(LiveServerTestCase):
|
|||||||
email = mail.outbox[0]
|
email = mail.outbox[0]
|
||||||
self.assertIn('activation required', email.subject)
|
self.assertIn('activation required', email.subject)
|
||||||
urls = re.findall(
|
urls = re.findall(
|
||||||
'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', email.message)
|
'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', email.body)
|
||||||
self.assertEqual(len(urls), 2)
|
self.assertEqual(len(urls), 1)
|
||||||
|
|
||||||
mail.outbox = [] # empty this for later
|
mail.outbox = [] # empty this for later
|
||||||
|
|
||||||
# Follow link
|
# Follow link
|
||||||
self.browser.get(urls[1]) # go to the second link
|
self.browser.get(urls[0]) # go to the first link
|
||||||
|
|
||||||
# Complete registration
|
# Complete registration
|
||||||
title_text = self.browser.find_element_by_tag_name('h2')
|
title_text = self.browser.find_element_by_tag_name('h2').text
|
||||||
self.assertIn('Complete', title_text)
|
self.assertIn('Complete', title_text)
|
||||||
|
|
||||||
# Test login
|
# Test login
|
||||||
@@ -123,12 +123,12 @@ class UserRegistrationTest(LiveServerTestCase):
|
|||||||
|
|
||||||
username.send_keys('TestUsername')
|
username.send_keys('TestUsername')
|
||||||
password.send_keys('correcthorsebatterystaple')
|
password.send_keys('correcthorsebatterystaple')
|
||||||
password.send_keys(Keys.ENTER)
|
|
||||||
self.browser.execute_script(
|
self.browser.execute_script(
|
||||||
"return jQuery('#g-recaptcha-response').val('PASSED')")
|
"return jQuery('#g-recaptcha-response').val('PASSED')")
|
||||||
|
password.send_keys(Keys.ENTER)
|
||||||
|
|
||||||
# Check we are logged in
|
# Check we are logged in
|
||||||
udd = self.browser.find_element_by_id('userdropdown')
|
udd = self.browser.find_element_by_class_name('navbar').text
|
||||||
self.assertIn('Hi John', udd)
|
self.assertIn('Hi John', udd)
|
||||||
|
|
||||||
# All is well
|
# All is well
|
||||||
|
|||||||
Reference in New Issue
Block a user