SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 198a79eb authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Update tests

parent 3235ab99
No related branches found
No related tags found
No related merge requests found
...@@ -105,17 +105,17 @@ class VetCommentaryRequestsTest(TestCase): ...@@ -105,17 +105,17 @@ class VetCommentaryRequestsTest(TestCase):
"""Test view permission is restricted to Vetting Editors.""" """Test view permission is restricted to Vetting Editors."""
# Anoymous user # Anoymous user
response = self.client.get(self.view_url) response = self.client.get(self.view_url)
self.assertEquals(response.status_code, 403) self.assertEqual(response.status_code, 403)
# Wrong permissions group # Wrong permissions group
self.client.login(username=self.contributor.user.username, password=self.password) self.client.login(username=self.contributor.user.username, password=self.password)
response = self.client.get(self.view_url) response = self.client.get(self.view_url)
self.assertEquals(response.status_code, 403) self.assertEqual(response.status_code, 403)
# Right permissions group # Right permissions group
self.set_required_permissions_and_login() self.set_required_permissions_and_login()
response = self.client.get(self.view_url) response = self.client.get(self.view_url)
self.assertEquals(response.status_code, 200) self.assertEqual(response.status_code, 200)
def test_get_valid_unvetted_commentaries(self): def test_get_valid_unvetted_commentaries(self):
"""Test if valid commentaries are sent back to user, if exists.""" """Test if valid commentaries are sent back to user, if exists."""
...@@ -124,13 +124,13 @@ class VetCommentaryRequestsTest(TestCase): ...@@ -124,13 +124,13 @@ class VetCommentaryRequestsTest(TestCase):
# No Commentary exists! # No Commentary exists!
response = self.client.get(self.view_url) response = self.client.get(self.view_url)
self.assertTrue('commentary_to_vet' in response.context) self.assertTrue('commentary_to_vet' in response.context)
self.assertEquals(response.context['commentary_to_vet'], None) self.assertEqual(response.context['commentary_to_vet'], None)
# Only vetted Commentaries exist! # Only vetted Commentaries exist!
# ContributorFactory.create_batch(5) # ContributorFactory.create_batch(5)
CommentaryFactory(requested_by=ContributorFactory(), vetted_by=ContributorFactory()) CommentaryFactory(requested_by=ContributorFactory(), vetted_by=ContributorFactory())
response = self.client.get(self.view_url) response = self.client.get(self.view_url)
self.assertEquals(response.context['commentary_to_vet'], None) self.assertEqual(response.context['commentary_to_vet'], None)
# Unvetted Commentaries do exist! # Unvetted Commentaries do exist!
UnvettedCommentaryFactory(requested_by=ContributorFactory()) UnvettedCommentaryFactory(requested_by=ContributorFactory())
...@@ -152,7 +152,7 @@ class BrowseCommentariesTest(TestCase): ...@@ -152,7 +152,7 @@ class BrowseCommentariesTest(TestCase):
def test_response_list(self): def test_response_list(self):
'''Test if the browse view is passing commentaries to anoymous users.''' '''Test if the browse view is passing commentaries to anoymous users.'''
response = self.client.get(self.view_url) response = self.client.get(self.view_url)
self.assertEquals(response.status_code, 200) self.assertEqual(response.status_code, 200)
# The created vetted Commentary is found! # The created vetted Commentary is found!
self.assertTrue(response.context['commentary_list'].count() >= 1) self.assertTrue(response.context['commentary_list'].count() >= 1)
......
...@@ -36,13 +36,13 @@ class RequestCommentaryTest(TestCase): ...@@ -36,13 +36,13 @@ class RequestCommentaryTest(TestCase):
# Registered Contributor should get 200 # Registered Contributor should get 200
self.client.login(username="Test", password="testpw") self.client.login(username="Test", password="testpw")
request = self.client.get(self.view_url) request = self.client.get(self.view_url)
self.assertEquals(request.status_code, 200) self.assertEqual(request.status_code, 200)
def test_post_invalid_forms(self): def test_post_invalid_forms(self):
"""Test different kind of invalid RequestCommentaryForm submits""" """Test different kind of invalid RequestCommentaryForm submits"""
self.client.login(username="Test", password="testpw") self.client.login(username="Test", password="testpw")
request = self.client.post(self.view_url) request = self.client.post(self.view_url)
self.assertEquals(request.status_code, 200) self.assertEqual(request.status_code, 200)
class VetCommentaryRequestsTest(TestCase): class VetCommentaryRequestsTest(TestCase):
...@@ -65,17 +65,17 @@ class VetCommentaryRequestsTest(TestCase): ...@@ -65,17 +65,17 @@ class VetCommentaryRequestsTest(TestCase):
"""Test view permission is restricted to Vetting Editors.""" """Test view permission is restricted to Vetting Editors."""
# Anoymous user # Anoymous user
response = self.client.get(self.view_url) response = self.client.get(self.view_url)
self.assertEquals(response.status_code, 403) self.assertEqual(response.status_code, 403)
# Wrong permissions group # Wrong permissions group
self.client.login(username=self.contributor.user.username, password=self.password) self.client.login(username=self.contributor.user.username, password=self.password)
response = self.client.get(self.view_url) response = self.client.get(self.view_url)
self.assertEquals(response.status_code, 403) self.assertEqual(response.status_code, 403)
# Right permissions group # Right permissions group
self.set_required_permissions_and_login() self.set_required_permissions_and_login()
response = self.client.get(self.view_url) response = self.client.get(self.view_url)
self.assertEquals(response.status_code, 200) self.assertEqual(response.status_code, 200)
def test_get_valid_unvetted_commentaries(self): def test_get_valid_unvetted_commentaries(self):
"""Test if valid commentaries are sent back to user, if exists.""" """Test if valid commentaries are sent back to user, if exists."""
...@@ -84,12 +84,12 @@ class VetCommentaryRequestsTest(TestCase): ...@@ -84,12 +84,12 @@ class VetCommentaryRequestsTest(TestCase):
# No Commentary exists! # No Commentary exists!
response = self.client.get(self.view_url) response = self.client.get(self.view_url)
self.assertTrue('commentary_to_vet' in response.context) self.assertTrue('commentary_to_vet' in response.context)
self.assertEquals(response.context['commentary_to_vet'], None) self.assertEqual(response.context['commentary_to_vet'], None)
# Only vetted Commentaries exist! # Only vetted Commentaries exist!
CommentaryFactory() CommentaryFactory()
response = self.client.get(self.view_url) response = self.client.get(self.view_url)
self.assertEquals(response.context['commentary_to_vet'], None) self.assertEqual(response.context['commentary_to_vet'], None)
# Unvetted Commentaries do exist! # Unvetted Commentaries do exist!
UnvettedCommentaryFactory() UnvettedCommentaryFactory()
...@@ -111,7 +111,7 @@ class BrowseCommentariesTest(TestCase): ...@@ -111,7 +111,7 @@ class BrowseCommentariesTest(TestCase):
def test_response_list(self): def test_response_list(self):
'''Test if the browse view is passing commentaries to anoymous users.''' '''Test if the browse view is passing commentaries to anoymous users.'''
response = self.client.get(self.view_url) response = self.client.get(self.view_url)
self.assertEquals(response.status_code, 200) self.assertEqual(response.status_code, 200)
# The created vetted Commentary is found! # The created vetted Commentary is found!
self.assertTrue(response.context['commentary_list'].count() >= 1) self.assertTrue(response.context['commentary_list'].count() >= 1)
......
...@@ -127,7 +127,7 @@ class PrefillUsingIdentifierTest(BaseContributorTestCase): ...@@ -127,7 +127,7 @@ class PrefillUsingIdentifierTest(BaseContributorTestCase):
# NOTED AS BROKEN 2019-11-08 # NOTED AS BROKEN 2019-11-08
# Traceback (most recent call last): # Traceback (most recent call last):
# File "/Users/jscaux/Sites/SciPost.org/scipost_v1/submissions/test_views.py", line 135, in test_submit_correct_manuscript # File "/Users/jscaux/Sites/SciPost.org/scipost_v1/submissions/test_views.py", line 135, in test_submit_correct_manuscript
# self.assertEquals(response.status_code, 403) # self.assertEqual(response.status_code, 403)
# AssertionError: 302 != 403 # AssertionError: 302 != 403
# class SubmitManuscriptTest(BaseContributorTestCase): # class SubmitManuscriptTest(BaseContributorTestCase):
# def test_submit_correct_manuscript(self): # def test_submit_correct_manuscript(self):
...@@ -137,7 +137,7 @@ class PrefillUsingIdentifierTest(BaseContributorTestCase): ...@@ -137,7 +137,7 @@ class PrefillUsingIdentifierTest(BaseContributorTestCase):
# # Unauthorized request shouldn't be possible # # Unauthorized request shouldn't be possible
# response = client.post(reverse('submissions:prefill_using_identifier'), # response = client.post(reverse('submissions:prefill_using_identifier'),
# {'identifier': TEST_SUBMISSION['identifier_w_vn_nr']}) # {'identifier': TEST_SUBMISSION['identifier_w_vn_nr']})
# self.assertEquals(response.status_code, 403) # self.assertEqual(response.status_code, 403)
# # Registered Contributor should get 200; assuming prefiller is working properly # # Registered Contributor should get 200; assuming prefiller is working properly
# self.assertTrue(client.login(username="Test", password="testpw")) # self.assertTrue(client.login(username="Test", password="testpw"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment