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
2fb06b63
Commit
2fb06b63
authored
7 years ago
by
Jorran de Wit
Browse files
Options
Downloads
Patches
Plain Diff
Add first basics for Submission cycle test
parent
95cc4219
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/helpers/test.py
+1
-0
1 addition, 0 deletions
common/helpers/test.py
submissions/factories.py
+23
-7
23 additions, 7 deletions
submissions/factories.py
with
24 additions
and
7 deletions
common/helpers/test.py
+
1
−
0
View file @
2fb06b63
import
scipost.management.commands.add_groups_and_permissions
def
add_groups_and_permissions
():
scipost
.
management
.
commands
.
add_groups_and_permissions
.
Command
().
handle
(
verbose
=
False
)
This diff is collapsed.
Click to expand it.
submissions/factories.py
+
23
−
7
View file @
2fb06b63
...
...
@@ -44,10 +44,13 @@ class SubmissionFactory(factory.django.DjangoModelFactory):
@factory.post_generation
def
contributors
(
self
,
create
,
extracted
,
**
kwargs
):
contributors
=
list
(
Contributor
.
objects
.
order_by
(
'
?
'
)
.
exclude
(
pk
=
self
.
submitted_by
.
pk
).
all
()[:
4
])
.
exclude
(
pk
=
self
.
submitted_by
.
pk
).
all
()[:
3
])
if
not
create
:
return
self
.
editor_in_charge
=
contributors
.
pop
()
# Auto-add the submitter as an author
self
.
authors
.
add
(
self
.
submitted_by
)
# Add three random authors
for
contrib
in
contributors
:
self
.
authors
.
add
(
contrib
)
self
.
author_list
+=
'
, %s %s
'
%
(
contrib
.
user
.
first_name
,
contrib
.
user
.
last_name
)
...
...
@@ -55,12 +58,22 @@ class SubmissionFactory(factory.django.DjangoModelFactory):
@factory.post_generation
def
dates
(
self
,
create
,
extracted
,
**
kwargs
):
timezone
.
now
()
self
.
submission_date
=
Faker
().
date_time_between
(
start_date
=
"
-3y
"
,
end_date
=
"
now
"
,
tzinfo
=
pytz
.
UTC
)
if
kwargs
.
get
(
'
submission
'
,
False
):
self
.
submission_date
=
kwargs
[
'
submission
'
]
else
:
self
.
submission_date
=
Faker
().
date_time_between
(
start_date
=
"
-3y
"
,
end_date
=
"
now
"
,
tzinfo
=
pytz
.
UTC
)
self
.
latest_activity
=
Faker
().
date_time_between
(
start_date
=
self
.
submission_date
,
end_date
=
"
now
"
,
tzinfo
=
pytz
.
UTC
)
class
UnassignedSubmissionFactory
(
SubmissionFactory
):
'''
This Submission is a
'
new request
'
by a Contributor for its Submission.
'''
status
=
STATUS_UNASSIGNED
class
EICassignedSubmissionFactory
(
SubmissionFactory
):
status
=
STATUS_EIC_ASSIGNED
open_for_commenting
=
True
...
...
@@ -70,9 +83,12 @@ class EICassignedSubmissionFactory(SubmissionFactory):
def
report_dates
(
self
,
create
,
extracted
,
**
kwargs
):
self
.
reporting_deadline
=
self
.
latest_activity
+
datetime
.
timedelta
(
weeks
=
2
)
class
UnassignedSubmissionFactory
(
SubmissionFactory
):
status
=
STATUS_UNASSIGNED
@factory.post_generation
def
eic
(
self
,
create
,
extracted
,
**
kwargs
):
author_ids
=
list
(
self
.
authors
.
values_list
(
'
id
'
,
flat
=
True
))
self
.
editor_in_charge
=
(
Contributor
.
objects
.
order_by
(
'
?
'
)
.
exclude
(
pk
=
self
.
submitted_by
.
pk
)
.
exclude
(
pk__in
=
author_ids
).
first
())
class
ResubmittedScreeningSubmissionFactory
(
SubmissionFactory
):
...
...
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