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
f259c6d1
Commit
f259c6d1
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
unit test for checking if nd number validation works
parent
a107e459
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!101
Resolve "list of subjects should contain columns dependent on the study"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
smash/web/forms/study_subject_forms.py
+3
-0
3 additions, 0 deletions
smash/web/forms/study_subject_forms.py
smash/web/tests/forms/test_StudySubjectAddForm.py
+6
-1
6 additions, 1 deletion
smash/web/tests/forms/test_StudySubjectAddForm.py
with
9 additions
and
1 deletion
smash/web/forms/study_subject_forms.py
+
3
−
0
View file @
f259c6d1
import
logging
import
re
from
django
import
forms
...
...
@@ -7,6 +8,8 @@ from web.forms.forms import DATETIMEPICKER_DATE_ATTRS, get_worker_from_args
from
web.models
import
StudySubject
,
Study
,
StudyColumns
from
web.models.constants
import
SCREENING_NUMBER_PREFIXES_FOR_TYPE
logger
=
logging
.
getLogger
(
__name__
)
class
StudySubjectAddForm
(
ModelForm
):
datetime_contact_reminder
=
forms
.
DateTimeField
(
label
=
"
Contact on
"
,
...
...
This diff is collapsed.
Click to expand it.
smash/web/tests/forms/test_StudySubjectAddForm.py
+
6
−
1
View file @
f259c6d1
...
...
@@ -30,9 +30,14 @@ class StudySubjectAddFormTests(LoggedInWithWorkerTestCase):
def
test_validation_for_study_without_columns
(
self
):
form
=
StudySubjectAddForm
(
data
=
self
.
sample_data
,
user
=
self
.
user
,
study
=
create_empty_study
())
form
.
is_valid
()
self
.
assertTrue
(
form
.
is_valid
())
def
test_validate_nd_number
(
self
):
self
.
sample_data
[
'
nd_number
'
]
=
'
invalid nd number
'
form
=
StudySubjectAddForm
(
data
=
self
.
sample_data
,
user
=
self
.
user
,
study
=
self
.
study
)
self
.
assertFalse
(
form
.
is_valid
())
self
.
assertTrue
(
"
nd_number
"
in
form
.
errors
)
def
test_invalid
(
self
):
form_data
=
self
.
sample_data
form_data
[
'
screening_number
'
]
=
"
123
"
...
...
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