-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prune old code for Journals/Faculty sign-ups (#3599)
* Prune old code for Journals/Faculty sign-ups * Remove now-extraneous import
- Loading branch information
Showing
6 changed files
with
0 additions
and
349 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
49 changes: 0 additions & 49 deletions
49
perma_web/perma/templates/registration/sign-up-faculty.html
This file was deleted.
Oops, something went wrong.
49 changes: 0 additions & 49 deletions
49
perma_web/perma/templates/registration/sign-up-journals.html
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2442,202 +2442,6 @@ def test_new_firm_failure(self): | |
) | ||
self.assertEqual(len(mail.outbox), 0) | ||
|
||
### Journals ### | ||
|
||
def new_journal(self): | ||
rand = random() | ||
return { 'requested_account_note': 'Journal {}'.format(rand)} | ||
|
||
def new_journal_user(self): | ||
rand = random() | ||
email = self.randomize_capitalization('user{}@university.org'.format(rand)) | ||
return { 'raw_email': email, | ||
'normalized_email': email.lower(), | ||
'first': 'Joe', | ||
'last': 'Yacobówski' } | ||
|
||
@override_settings(REQUIRE_JS_FORM_SUBMISSIONS=False) | ||
def test_new_journal_success(self): | ||
''' | ||
Does the journal signup form submit as expected? Success cases. | ||
''' | ||
new_journal = self.new_journal() | ||
new_user = self.new_journal_user() | ||
existing_user = {'email': '[email protected]'} | ||
expected_emails_sent = 0 | ||
|
||
# NOT LOGGED IN | ||
|
||
# New user email address + journal info | ||
self.submit_form('sign_up_journals', | ||
data = { 'e-address': new_user['raw_email'], | ||
'requested_account_note': new_journal['requested_account_note']}, | ||
success_url = reverse('register_email_instructions')) | ||
expected_emails_sent += 1 | ||
self.assertEqual(len(mail.outbox), expected_emails_sent) | ||
self.check_new_activation_email(mail.outbox[expected_emails_sent - 1], new_user['raw_email']) | ||
|
||
# LOGGED IN | ||
|
||
# New user email address + journal info | ||
# (This succeeds and creates a new account; see issue 1749) | ||
new_user = self.new_journal_user() | ||
self.submit_form('sign_up_journals', | ||
data = { 'e-address': new_user['raw_email'], | ||
'requested_account_note': new_journal['requested_account_note']}, | ||
user = existing_user['email'], | ||
success_url = reverse('register_email_instructions')) | ||
expected_emails_sent += 1 | ||
self.assertEqual(len(mail.outbox), expected_emails_sent) | ||
self.check_new_activation_email(mail.outbox[expected_emails_sent - 1], new_user['raw_email']) | ||
|
||
@override_settings(REQUIRE_JS_FORM_SUBMISSIONS=False) | ||
def test_new_journal_form_honeypot(self): | ||
new_journal = self.new_journal() | ||
new_user = self.new_journal_user() | ||
self.submit_form('sign_up_journals', | ||
data = { 'e-address': new_user['raw_email'], | ||
'requested_account_note': new_journal['requested_account_note'], | ||
'telephone': "I'm a bot." }, | ||
success_url = reverse('register_email_instructions')) | ||
self.assertEqual(len(mail.outbox), 0) | ||
self.assertFalse(LinkUser.objects.filter(email__iexact=new_user['raw_email']).exists()) | ||
|
||
@override_settings(REQUIRE_JS_FORM_SUBMISSIONS=False) | ||
def test_new_journal_failure(self): | ||
''' | ||
Does the journal signup form submit as expected? Failure cases. | ||
''' | ||
|
||
# NOT LOGGED IN | ||
|
||
# Blank submission reports correct fields required | ||
self.submit_form('sign_up_journals', | ||
data = {}, | ||
error_keys = ['email', 'requested_account_note']) | ||
self.assertEqual(len(mail.outbox), 0) | ||
|
||
# If email address already belongs to an account, validation fails | ||
self.submit_form('sign_up_journals', | ||
data = { 'e-address': self.randomize_capitalization('[email protected]'), | ||
'requested_account_note': 'Here'}, | ||
error_keys = ['email']) | ||
self.assertEqual(len(mail.outbox), 0) | ||
|
||
# LOGGED IN | ||
# (This is odd; see issue 1749) | ||
|
||
# Blank submission reports correct fields required | ||
self.submit_form('sign_up_journals', | ||
data = {}, | ||
user = '[email protected]', | ||
error_keys = ['email', 'requested_account_note']) | ||
self.assertEqual(len(mail.outbox), 0) | ||
|
||
# If email address already belongs to an account, validation fails | ||
self.submit_form('sign_up_journals', | ||
data = { 'e-address': self.randomize_capitalization('[email protected]'), | ||
'requested_account_note': 'Here'}, | ||
user = '[email protected]', | ||
error_keys = ['email']) | ||
self.assertEqual(len(mail.outbox), 0) | ||
|
||
|
||
### Faculty ### | ||
|
||
def new_faculty_user(self): | ||
rand = random() | ||
email = self.randomize_capitalization('user{}@university.org'.format(rand)) | ||
return { 'raw_email': email, | ||
'normalized_email': email.lower(), | ||
'first': 'Joe', | ||
'last': 'Yacobówski', | ||
'requested_account_note': 'Journal {}'.format(rand) } | ||
|
||
@override_settings(REQUIRE_JS_FORM_SUBMISSIONS=False) | ||
def test_new_faculty_success(self): | ||
''' | ||
Does the faculty signup form submit as expected? Success cases. | ||
''' | ||
new_user = self.new_faculty_user() | ||
existing_user = {'email': '[email protected]'} | ||
expected_emails_sent = 0 | ||
|
||
# NOT LOGGED IN | ||
|
||
# New user email address + journal info | ||
self.submit_form('sign_up_faculty', | ||
data = { 'e-address': new_user['raw_email'], | ||
'requested_account_note': new_user['requested_account_note']}, | ||
success_url = reverse('register_email_instructions')) | ||
expected_emails_sent += 1 | ||
self.assertEqual(len(mail.outbox), expected_emails_sent) | ||
self.check_new_activation_email(mail.outbox[expected_emails_sent - 1], new_user['raw_email']) | ||
|
||
# LOGGED IN | ||
|
||
# New user email address + journal info | ||
# (This succeeds and creates a new account; see issue 1749) | ||
new_user = self.new_faculty_user() | ||
self.submit_form('sign_up_faculty', | ||
data = { 'e-address': new_user['raw_email'], | ||
'requested_account_note': new_user['requested_account_note']}, | ||
user = existing_user['email'], | ||
success_url = reverse('register_email_instructions')) | ||
expected_emails_sent += 1 | ||
self.assertEqual(len(mail.outbox), expected_emails_sent) | ||
self.check_new_activation_email(mail.outbox[expected_emails_sent - 1], new_user['raw_email']) | ||
|
||
@override_settings(REQUIRE_JS_FORM_SUBMISSIONS=False) | ||
def test_new_faculty_form_honeypot(self): | ||
new_user = self.new_faculty_user() | ||
self.submit_form('sign_up_faculty', | ||
data = { 'e-address': new_user['raw_email'], | ||
'requested_account_note': new_user['requested_account_note'], | ||
'telephone': "I'm a bot." }, | ||
success_url = reverse('register_email_instructions')) | ||
self.assertEqual(len(mail.outbox), 0) | ||
self.assertFalse(LinkUser.objects.filter(email__iexact=new_user['raw_email']).exists()) | ||
|
||
@override_settings(REQUIRE_JS_FORM_SUBMISSIONS=False) | ||
def test_new_faculty_failure(self): | ||
''' | ||
Does the faculty signup form submit as expected? Failure cases. | ||
''' | ||
|
||
# NOT LOGGED IN | ||
|
||
# Blank submission reports correct fields required | ||
self.submit_form('sign_up_faculty', | ||
data = {}, | ||
error_keys = ['email', 'requested_account_note']) | ||
self.assertEqual(len(mail.outbox), 0) | ||
|
||
# If email address already belongs to an account, validation fails | ||
self.submit_form('sign_up_faculty', | ||
data = { 'e-address': self.randomize_capitalization('[email protected]'), | ||
'requested_account_note': 'Here'}, | ||
error_keys = ['email']) | ||
self.assertEqual(len(mail.outbox), 0) | ||
|
||
# LOGGED IN | ||
# (This is odd; see issue 1749) | ||
|
||
# Blank submission reports correct fields required | ||
self.submit_form('sign_up_faculty', | ||
data = {}, | ||
user = '[email protected]', | ||
error_keys = ['email', 'requested_account_note']) | ||
self.assertEqual(len(mail.outbox), 0) | ||
|
||
# If email address already belongs to an account, validation fails | ||
self.submit_form('sign_up_faculty', | ||
data = { 'e-address': self.randomize_capitalization('[email protected]'), | ||
'requested_account_note': 'Here'}, | ||
user = '[email protected]', | ||
error_keys = ['email']) | ||
self.assertEqual(len(mail.outbox), 0) | ||
|
||
### Individual Users ### | ||
|
||
def check_new_activation_email(self, message, user_email): | ||
|
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