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
f6f913ec
Commit
f6f913ec
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
unit tests for voucher_type view
parent
47f28f7f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!112
Resolve "voucher types"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
smash/web/tests/functions.py
+6
-1
6 additions, 1 deletion
smash/web/tests/functions.py
smash/web/tests/view/test_voucher_type.py
+32
-0
32 additions, 0 deletions
smash/web/tests/view/test_voucher_type.py
with
38 additions
and
1 deletion
smash/web/tests/functions.py
+
6
−
1
View file @
f6f913ec
...
...
@@ -5,7 +5,8 @@ import os
from
django.contrib.auth.models
import
User
from
web.models
import
Location
,
AppointmentType
,
StudySubject
,
Worker
,
Visit
,
Appointment
,
ConfigurationItem
,
\
Language
,
ContactAttempt
,
FlyingTeam
,
Availability
,
Subject
,
Study
,
StudyColumns
,
StudyNotificationParameters
Language
,
ContactAttempt
,
FlyingTeam
,
Availability
,
Subject
,
Study
,
StudyColumns
,
StudyNotificationParameters
,
\
VoucherType
from
web.models.constants
import
REDCAP_TOKEN_CONFIGURATION_TYPE
,
REDCAP_BASE_URL_CONFIGURATION_TYPE
,
\
SEX_CHOICES_MALE
,
SUBJECT_TYPE_CHOICES_CONTROL
,
CONTACT_TYPES_PHONE
,
\
MONDAY_AS_DAY_OF_WEEK
,
COUNTRY_AFGHANISTAN_ID
...
...
@@ -26,6 +27,10 @@ def create_location(name="test"):
return
Location
.
objects
.
create
(
name
=
name
)
def
create_voucher_type
():
return
VoucherType
.
objects
.
create
(
code
=
"
X
"
,
study
=
get_test_study
())
def
create_empty_study_columns
():
study_columns
=
StudyColumns
.
objects
.
create
(
postponed
=
False
,
...
...
This diff is collapsed.
Click to expand it.
smash/web/tests/view/test_voucher_type.py
0 → 100644
+
32
−
0
View file @
f6f913ec
import
logging
from
django.urls
import
reverse
from
web.models
import
VoucherType
from
web.models.constants
import
GLOBAL_STUDY_ID
from
web.tests.functions
import
create_voucher_type
from
..
import
LoggedInTestCase
logger
=
logging
.
getLogger
(
__name__
)
class
VoucherTypeViewTests
(
LoggedInTestCase
):
def
test_render_add_voucher_type_request
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'
web.views.voucher_type_add
'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_render_edit_voucher_type_request
(
self
):
voucher_type
=
create_voucher_type
()
response
=
self
.
client
.
get
(
reverse
(
'
web.views.voucher_type_edit
'
,
kwargs
=
{
'
pk
'
:
voucher_type
.
id
}))
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_add_voucher_type
(
self
):
form_data
=
{
'
code
'
:
"
X
"
,
'
description
'
:
"
y
"
,
'
study
'
:
str
(
GLOBAL_STUDY_ID
),
}
response
=
self
.
client
.
post
(
reverse
(
'
web.views.voucher_type_add
'
),
data
=
form_data
)
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
1
,
VoucherType
.
objects
.
all
().
count
())
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