Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scheduling-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
SMASCH
scheduling-system
Commits
a7993826
Commit
a7993826
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
tests for list of subjects added
parent
4f1d4c2e
No related branches found
No related tags found
1 merge request
!31
Tests added
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smash/web/tests/test_view_subjects.py
+22
-2
22 additions, 2 deletions
smash/web/tests/test_view_subjects.py
with
22 additions
and
2 deletions
smash/web/tests/test_view_subjects.py
+
22
−
2
View file @
a7993826
import
datetime
from
django.contrib.auth.models
import
User
from
django.test
import
Client
from
django.test
import
TestCase
...
...
@@ -7,6 +9,7 @@ from functions import create_subject, create_worker, get_test_location
from
web.forms
import
SubjectAddForm
from
web.models
import
Subject
from
web.models.constants
import
SEX_CHOICES_MALE
,
SUBJECT_TYPE_CHOICES_CONTROL
from
web.views.notifications
import
get_today_midnight_date
class
SubjectsViewTests
(
TestCase
):
...
...
@@ -34,7 +37,7 @@ class SubjectsViewTests(TestCase):
self
.
worker
.
screening_number_prefix
=
"
X
"
self
.
worker
.
save
()
form
=
SubjectAddForm
(
user
=
self
.
user
)
form
=
SubjectAddForm
(
user
=
self
.
user
)
form_data
=
{}
for
key
,
value
in
form
.
initial
.
items
():
if
value
is
not
None
:
...
...
@@ -51,6 +54,23 @@ class SubjectsViewTests(TestCase):
self
.
assertEqual
(
response
.
status_code
,
302
)
subject
=
Subject
.
objects
.
all
()[
0
]
self
.
assertEqual
(
"
X-001
"
,
subject
.
screening_number
)
self
.
assertEqual
(
"
X-001
"
,
subject
.
screening_number
)
def
test_render_subjects
(
self
):
create_subject
()
response
=
self
.
client
.
get
(
reverse
(
'
web.views.subjects
'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_render_subjects_with_no_visit
(
self
):
create_subject
()
response
=
self
.
client
.
get
(
reverse
(
'
web.views.subject_no_visits
'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_render_subjects_require_contact
(
self
):
subject
=
create_subject
()
subject
.
datetime_contact_reminder
=
get_today_midnight_date
()
+
datetime
.
timedelta
(
days
=-
1
)
response
=
self
.
client
.
get
(
reverse
(
'
web.views.subject_require_contact
'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
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