-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
90 additions
and
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,7 +206,6 @@ def test_orcid_registration(self, record_mock): | |
self.assertEqual(response.status_code, 200) | ||
self.assertContains(response, "Campbell") | ||
self.assertContains(response, "Kasey") | ||
self.assertContains(response, "Elk Valley University") | ||
self.assertContains(response, "[email protected]") | ||
self.assertNotContains(response, "Register with ORCiD") | ||
self.assertContains(response, "http://sandbox.orcid.org/0000-0000-0000-0000") | ||
|
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 |
---|---|---|
|
@@ -66,28 +66,32 @@ def create_journal(): | |
|
||
return journal_one | ||
|
||
@staticmethod | ||
def create_authors(): | ||
@classmethod | ||
def create_authors(cls): | ||
author_1_data = { | ||
'email': '[email protected]', | ||
'is_active': True, | ||
'password': 'this_is_a_password', | ||
'salutation': 'Prof.', | ||
'first_name': 'Martin', | ||
'middle_name': '', | ||
'last_name': 'Eve', | ||
'department': 'English & Humanities', | ||
'institution': 'Birkbeck, University of London', | ||
} | ||
author_2_data = { | ||
'email': '[email protected]', | ||
'is_active': True, | ||
'password': 'this_is_a_password', | ||
'salutation': 'Sr.', | ||
'first_name': 'Mauro', | ||
'middle_name': '', | ||
'last_name': 'Sanchez', | ||
'department': 'English & Humanities', | ||
'institution': 'Birkbeck, University of London', | ||
} | ||
author_1 = Account.objects.create(email="[email protected]", **author_1_data) | ||
author_2 = Account.objects.create(email="[email protected]", **author_2_data) | ||
author_1 = helpers.create_author(cls.journal_one, **author_1_data) | ||
author_2 = helpers.create_author(cls.journal_one, **author_2_data) | ||
|
||
return author_1, author_2 | ||
|
||
|
@@ -105,12 +109,15 @@ def create_sections(self): | |
journal=self.journal_one, | ||
) | ||
|
||
@classmethod | ||
def setUpTestData(cls): | ||
cls.journal_one = cls.create_journal() | ||
|
||
def setUp(self): | ||
""" | ||
Setup the test environment. | ||
:return: None | ||
""" | ||
self.journal_one = self.create_journal() | ||
self.editor = helpers.create_editor(self.journal_one) | ||
self.press = helpers.create_press() | ||
self.create_sections() | ||
|
@@ -273,7 +280,9 @@ def test_snapshot_author_metadata_override(self): | |
|
||
article.snapshot_authors() | ||
new_department = "New department" | ||
article.frozen_authors().update(department=new_department) | ||
for frozen in article.frozen_authors(): | ||
frozen.department = new_department | ||
frozen.save() | ||
article.snapshot_authors(force_update=True) | ||
frozen = article.frozen_authors().all()[0] | ||
|
||
|
@@ -576,15 +585,12 @@ def test_author_form_harmful_inputs(self): | |
"middle_name", | ||
"name_prefix", | ||
"suffix", | ||
"institution", | ||
"department", | ||
}): | ||
form = forms.AuthorForm( | ||
{ | ||
'first_name': 'Andy', | ||
'last_name': 'Byers', | ||
'biography': 'Andy', | ||
'institution': 'Birkbeck, University of London', | ||
'email': f'andy{i}@janeway.systems', | ||
'orcid': 'https://orcid.org/0000-0003-2126-266X', | ||
**{attr: harmful_string}, | ||
|
@@ -783,37 +789,44 @@ def create_journal(): | |
|
||
return journal_one | ||
|
||
@staticmethod | ||
def create_authors(): | ||
@classmethod | ||
def create_authors(cls): | ||
author_1_data = { | ||
'email': '[email protected]', | ||
'is_active': True, | ||
'password': 'this_is_a_password', | ||
'salutation': 'Prof.', | ||
'first_name': 'Martin', | ||
'middle_name': '', | ||
'last_name': 'Eve', | ||
'department': 'English & Humanities', | ||
'institution': 'Birkbeck, University of London', | ||
} | ||
author_2_data = { | ||
'email': '[email protected]', | ||
'is_active': True, | ||
'password': 'this_is_a_password', | ||
'salutation': 'Sr.', | ||
'first_name': 'Mauro', | ||
'middle_name': '', | ||
'last_name': 'Sanchez', | ||
'department': 'English & Humanities', | ||
'institution': 'Birkbeck, University of London', | ||
} | ||
author_1 = Account.objects.create(email="[email protected]", **author_1_data) | ||
author_2 = Account.objects.create(email="[email protected]", **author_1_data) | ||
author_1 = helpers.create_author(cls.journal_one, **author_1_data) | ||
author_2 = helpers.create_author(cls.journal_one, **author_2_data) | ||
|
||
return author_1, author_2 | ||
|
||
@classmethod | ||
def setUpTestData(cls): | ||
cls.journal_one = cls.create_journal() | ||
|
||
def setUp(self): | ||
""" | ||
Setup the test environment. | ||
:return: None | ||
""" | ||
self.journal_one = self.create_journal() | ||
self.editor = helpers.create_editor(self.journal_one) | ||
self.press = helpers.create_press() | ||
|
||
|
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