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
Merge requests
!115
Resolve "PDP study patient data"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "PDP study patient data"
186-pdp-study-patient-data
into
master
Overview
0
Commits
8
Pipelines
3
Changes
1
Merged
Piotr Gawron
requested to merge
186-pdp-study-patient-data
into
master
7 years ago
Overview
0
Commits
8
Pipelines
3
Changes
1
Expand
Closes
#186 (closed)
Edited
7 years ago
by
Piotr Gawron
0
0
Merge request reports
Viewing commit
3305777e
Prev
Next
Show latest version
1 file
+
43
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
3305777e
unit tests for sorting subjects
· 3305777e
Piotr Gawron
authored
7 years ago
smash/web/tests/api_views/test_subject.py
+
43
−
2
Options
@@ -5,12 +5,12 @@ import logging
from
django.urls
import
reverse
from
web.tests
import
LoggedInWithWorkerTestCase
from
web.api_views.subject
import
get_subjects_order
,
get_subjects_filtered
,
serialize_subject
from
web.models
import
StudySubject
,
Appointment
,
Study
from
web.models
import
StudySubject
,
Appointment
,
Study
,
Worker
from
web.models.constants
import
GLOBAL_STUDY_ID
,
SUBJECT_TYPE_CHOICES_PATIENT
,
SUBJECT_TYPE_CHOICES_CONTROL
from
web.models.study_subject_list
import
SUBJECT_LIST_GENERIC
,
SUBJECT_LIST_NO_VISIT
,
SUBJECT_LIST_REQUIRE_CONTACT
,
\
StudySubjectList
from
web.tests
import
LoggedInWithWorkerTestCase
from
web.tests.functions
import
create_study_subject
,
create_get_suffix
,
create_visit
,
\
create_appointment
,
create_empty_study_columns
,
create_contact_attempt
,
create_flying_team
from
web.views.notifications
import
get_today_midnight_date
@@ -534,3 +534,44 @@ class TestSubjectApi(LoggedInWithWorkerTestCase):
create_contact_attempt
(
subject
=
subject
)
self
.
check_subject_ordered
(
"
last_contact_attempt
"
,
[
subject
,
subject2
])
def
test_subjects_ordered_by_information_sent
(
self
):
subject
=
self
.
study_subject
subject
.
information_sent
=
False
subject
.
save
()
subject2
=
create_study_subject
(
2
)
subject2
.
information_sent
=
True
subject2
.
save
()
self
.
check_subject_ordered
(
"
information_sent
"
,
[
subject
,
subject2
])
def
test_subjects_ordered_by_type
(
self
):
subject
=
self
.
study_subject
subject
.
type
=
SUBJECT_TYPE_CHOICES_CONTROL
subject
.
save
()
subject2
=
create_study_subject
(
2
)
subject2
.
type
=
SUBJECT_TYPE_CHOICES_PATIENT
subject2
.
save
()
self
.
check_subject_ordered
(
"
type
"
,
[
subject
,
subject2
])
def
test_subjects_ordered_by_social_security_number
(
self
):
subject
=
self
.
study_subject
subject
.
subject
.
social_security_number
=
"
01
"
subject
.
subject
.
save
()
subject2
=
create_study_subject
(
2
)
subject2
.
subject
.
social_security_number
=
"
02
"
subject2
.
subject
.
save
()
self
.
check_subject_ordered
(
"
social_security_number
"
,
[
subject
,
subject2
])
def
test_subjects_ordered_by_health_partner
(
self
):
subject
=
self
.
study_subject
subject
.
health_partner
=
Worker
.
objects
.
create
(
first_name
=
'
first1
'
,
last_name
=
"
name2222
"
,
email
=
'
jacob@bla
'
,
)
subject
.
save
()
subject2
=
create_study_subject
(
2
)
subject2
.
health_partner
=
Worker
.
objects
.
create
(
first_name
=
'
first2
'
,
last_name
=
"
name1111
"
,
email
=
'
jacob@bla
'
,
)
subject2
.
save
()
self
.
check_subject_ordered
(
"
health_partner_first_name
"
,
[
subject
,
subject2
])
self
.
check_subject_ordered
(
"
health_partner_last_name
"
,
[
subject2
,
subject
])
Loading