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
97f982fa
Commit
97f982fa
authored
4 years ago
by
Carlos Vega
Browse files
Options
Downloads
Patches
Plain Diff
added tests for subject and studysubject delete views
parent
a96da948
No related branches found
No related tags found
1 merge request
!277
Resolve "possibility to remove subject"
Pipeline
#34460
passed
4 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smash/web/tests/view/test_subjects.py
+25
-1
25 additions, 1 deletion
smash/web/tests/view/test_subjects.py
with
25 additions
and
1 deletion
smash/web/tests/view/test_subjects.py
+
25
−
1
View file @
97f982fa
...
@@ -6,7 +6,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile
...
@@ -6,7 +6,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile
from
django.urls
import
reverse
from
django.urls
import
reverse
from
web.forms
import
SubjectAddForm
,
SubjectEditForm
,
StudySubjectAddForm
,
StudySubjectEditForm
from
web.forms
import
SubjectAddForm
,
SubjectEditForm
,
StudySubjectAddForm
,
StudySubjectEditForm
from
web.models
import
MailTemplate
,
StudySubject
,
StudyColumns
,
Visit
,
Provenance
from
web.models
import
MailTemplate
,
StudySubject
,
StudyColumns
,
Visit
,
Provenance
,
Subject
from
web.models.constants
import
SEX_CHOICES_MALE
,
SUBJECT_TYPE_CHOICES_CONTROL
,
SUBJECT_TYPE_CHOICES_PATIENT
,
\
from
web.models.constants
import
SEX_CHOICES_MALE
,
SUBJECT_TYPE_CHOICES_CONTROL
,
SUBJECT_TYPE_CHOICES_PATIENT
,
\
COUNTRY_AFGHANISTAN_ID
,
COUNTRY_OTHER_ID
,
MAIL_TEMPLATE_CONTEXT_SUBJECT
,
CUSTOM_FIELD_TYPE_FILE
COUNTRY_AFGHANISTAN_ID
,
COUNTRY_OTHER_ID
,
MAIL_TEMPLATE_CONTEXT_SUBJECT
,
CUSTOM_FIELD_TYPE_FILE
from
web.models.custom_data
import
CustomStudySubjectField
from
web.models.custom_data
import
CustomStudySubjectField
...
@@ -140,6 +140,30 @@ class SubjectsViewTests(LoggedInWithWorkerTestCase):
...
@@ -140,6 +140,30 @@ class SubjectsViewTests(LoggedInWithWorkerTestCase):
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertTrue
(
"
edit
"
in
response
.
url
)
self
.
assertTrue
(
"
edit
"
in
response
.
url
)
def
test_delete_subject
(
self
):
self
.
login_as_super
()
study_subject
=
create_study_subject
()
subject
=
study_subject
.
subject
self
.
assertEqual
(
1
,
Subject
.
objects
.
filter
(
id
=
subject
.
id
).
count
())
self
.
assertEqual
(
1
,
StudySubject
.
objects
.
filter
(
id
=
study_subject
.
id
).
count
())
url
=
reverse
(
'
web.views.subject_delete
'
,
kwargs
=
{
'
pk
'
:
subject
.
id
})
response
=
self
.
client
.
post
(
url
)
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
0
,
Subject
.
objects
.
filter
(
id
=
subject
.
id
).
count
())
self
.
assertEqual
(
0
,
StudySubject
.
objects
.
filter
(
id
=
study_subject
.
id
).
count
())
def
test_delete_subject
(
self
):
self
.
login_as_super
()
study_subject
=
create_study_subject
()
subject
=
study_subject
.
subject
self
.
assertEqual
(
1
,
Subject
.
objects
.
filter
(
id
=
subject
.
id
).
count
())
self
.
assertEqual
(
1
,
StudySubject
.
objects
.
filter
(
id
=
study_subject
.
id
).
count
())
url
=
reverse
(
'
web.views.study_subject_delete
'
,
kwargs
=
{
'
pk
'
:
study_subject
.
id
})
response
=
self
.
client
.
post
(
url
)
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
1
,
Subject
.
objects
.
filter
(
id
=
subject
.
id
).
count
())
self
.
assertEqual
(
0
,
StudySubject
.
objects
.
filter
(
id
=
study_subject
.
id
).
count
())
def
create_edit_form_data_for_study_subject
(
self
,
instance
:
StudySubject
=
None
):
def
create_edit_form_data_for_study_subject
(
self
,
instance
:
StudySubject
=
None
):
if
instance
is
None
:
if
instance
is
None
:
instance
=
self
.
study_subject
instance
=
self
.
study_subject
...
...
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