SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SciPost
SciPost
Commits
198a79eb
Commit
198a79eb
authored
5 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
Update tests
parent
3235ab99
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
commentaries/tests/test_views.py
+6
-6
6 additions, 6 deletions
commentaries/tests/test_views.py
scipost/tests/test_views.py
+8
-8
8 additions, 8 deletions
scipost/tests/test_views.py
submissions/tests/test_views.py
+2
-2
2 additions, 2 deletions
submissions/tests/test_views.py
with
16 additions
and
16 deletions
commentaries/tests/test_views.py
+
6
−
6
View file @
198a79eb
...
@@ -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
.
assertEqual
s
(
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
.
assertEqual
s
(
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
.
assertEqual
s
(
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
.
assertEqual
s
(
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
.
assertEqual
s
(
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
.
assertEqual
s
(
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
)
...
...
This diff is collapsed.
Click to expand it.
scipost/tests/test_views.py
+
8
−
8
View file @
198a79eb
...
@@ -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
.
assertEqual
s
(
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
.
assertEqual
s
(
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
.
assertEqual
s
(
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
.
assertEqual
s
(
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
.
assertEqual
s
(
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
.
assertEqual
s
(
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
.
assertEqual
s
(
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
.
assertEqual
s
(
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
)
...
...
This diff is collapsed.
Click to expand it.
submissions/tests/test_views.py
+
2
−
2
View file @
198a79eb
...
@@ -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.assertEqual
s
(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.assertEqual
s
(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"))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment