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
eeb08c9c
Commit
eeb08c9c
authored
7 years ago
by
Jorran de Wit
Browse files
Options
Downloads
Patches
Plain Diff
Add tests Author-check CreateSubmissionView
parent
699cdaa3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
submissions/test_views.py
+37
-0
37 additions, 0 deletions
submissions/test_views.py
with
37 additions
and
0 deletions
submissions/test_views.py
+
37
−
0
View file @
eeb08c9c
...
@@ -52,6 +52,7 @@ class BaseContributorTestCase(TestCase):
...
@@ -52,6 +52,7 @@ class BaseContributorTestCase(TestCase):
add_groups_and_permissions
()
add_groups_and_permissions
()
ContributorFactory
.
create_batch
(
5
)
ContributorFactory
.
create_batch
(
5
)
ContributorFactory
.
create
(
ContributorFactory
.
create
(
user__last_name
=
'
Linder
'
,
# To pass the author check in create submissions view
user__username
=
'
Test
'
,
user__username
=
'
Test
'
,
user__password
=
'
testpw
'
user__password
=
'
testpw
'
)
)
...
@@ -111,6 +112,7 @@ class PrefillUsingIdentifierTest(BaseContributorTestCase):
...
@@ -111,6 +112,7 @@ class PrefillUsingIdentifierTest(BaseContributorTestCase):
class
SubmitManuscriptTest
(
BaseContributorTestCase
):
class
SubmitManuscriptTest
(
BaseContributorTestCase
):
def
test_submit_correct_manuscript
(
self
):
def
test_submit_correct_manuscript
(
self
):
'''
Check is view POST request works as expected.
'''
client
=
Client
()
client
=
Client
()
# Unauthorized request shouldn't be possible
# Unauthorized request shouldn't be possible
...
@@ -153,6 +155,41 @@ class SubmitManuscriptTest(BaseContributorTestCase):
...
@@ -153,6 +155,41 @@ class SubmitManuscriptTest(BaseContributorTestCase):
self
.
assertEqual
(
TEST_SUBMISSION
[
'
arxiv_link
'
],
submission
.
arxiv_link
)
self
.
assertEqual
(
TEST_SUBMISSION
[
'
arxiv_link
'
],
submission
.
arxiv_link
)
self
.
assertEqual
(
TEST_SUBMISSION
[
'
abstract
'
],
submission
.
abstract
)
self
.
assertEqual
(
TEST_SUBMISSION
[
'
abstract
'
],
submission
.
abstract
)
def
test_non_author_tries_submission
(
self
):
'''
See what happens if a non-author of an Arxiv submission submits to SciPost.
'''
client
=
Client
()
# Contributor Linder tries to submit the Quench Action.
# Eventually this call should already give an error. Waiting for
# Arxiv caller which is under construction [Jorran de Wit, 12 May 2017]
self
.
assertTrue
(
client
.
login
(
username
=
"
Test
"
,
password
=
"
testpw
"
))
response
=
client
.
post
(
reverse
(
'
submissions:prefill_using_identifier
'
),
{
'
identifier
'
:
'
1603.04689v1
'
})
self
.
assertEqual
(
response
.
status_code
,
200
)
# Fill form parameters
params
=
response
.
context
[
'
form
'
].
initial
params
.
update
({
'
discipline
'
:
'
physics
'
,
'
subject_area
'
:
'
Phys:MP
'
,
'
submitted_to_journal
'
:
'
SciPostPhys
'
,
'
submission_type
'
:
'
Article
'
,
'
domain
'
:
'
T
'
})
params
[
'
metadata
'
]
=
json
.
dumps
(
params
[
'
metadata
'
],
separators
=
(
'
,
'
,
'
:
'
))
# Submit new Submission form
response
=
client
.
post
(
reverse
(
'
submissions:submit_manuscript
'
),
params
)
self
.
assertEqual
(
response
.
status_code
,
302
)
# No real check is done here to see if submission submit is aborted.
# To be implemented after Arxiv caller.
# Temporary fix:
last_submission
=
Submission
.
objects
.
last
()
if
last_submission
:
self
.
assertNotEqual
(
last_submission
.
title
,
'
The Quench Action
'
)
self
.
assertNotEqual
(
last_submission
.
arxiv_identifier_w_vn_nr
,
'
1603.04689v1
'
)
class
SubmissionDetailTest
(
BaseContributorTestCase
):
class
SubmissionDetailTest
(
BaseContributorTestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
...
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