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
5a6ab296
Commit
5a6ab296
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
unit test for rendering mail templates in subject scope
parent
e1387ba7
No related branches found
No related tags found
1 merge request
!100
Test coverage unit tests
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smash/web/tests/view/test_subjects.py
+18
-3
18 additions, 3 deletions
smash/web/tests/view/test_subjects.py
with
18 additions
and
3 deletions
smash/web/tests/view/test_subjects.py
+
18
−
3
View file @
5a6ab296
...
@@ -4,11 +4,12 @@ import logging
...
@@ -4,11 +4,12 @@ import logging
from
django.urls
import
reverse
from
django.urls
import
reverse
from
web.forms
import
StudySubjectAddForm
,
StudySubjectEditForm
,
SubjectEditForm
,
SubjectAddForm
from
web.forms
import
StudySubjectAddForm
,
StudySubjectEditForm
,
SubjectEditForm
,
SubjectAddForm
from
web.models
import
StudySubject
from
web.models
import
MailTemplate
,
StudySubject
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
COUNTRY_AFGHANISTAN_ID
,
COUNTRY_OTHER_ID
,
MAIL_TEMPLATE_CONTEXT_SUBJECT
from
web.tests
import
LoggedInWithWorkerTestCase
from
web.tests
import
LoggedInWithWorkerTestCase
from
web.tests.functions
import
create_study_subject
,
create_visit
,
create_appointment
,
get_test_location
from
web.tests.functions
import
create_study_subject
,
create_visit
,
create_appointment
,
get_test_location
,
\
create_language
,
get_resource_path
from
web.views.notifications
import
get_today_midnight_date
from
web.views.notifications
import
get_today_midnight_date
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -29,6 +30,20 @@ class SubjectsViewTests(LoggedInWithWorkerTestCase):
...
@@ -29,6 +30,20 @@ class SubjectsViewTests(LoggedInWithWorkerTestCase):
response
=
self
.
client
.
get
(
reverse
(
'
web.views.subject_edit
'
,
kwargs
=
{
'
id
'
:
self
.
study_subject
.
id
}))
response
=
self
.
client
.
get
(
reverse
(
'
web.views.subject_edit
'
,
kwargs
=
{
'
id
'
:
self
.
study_subject
.
id
}))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_render_subject_edit_with_mail_templates
(
self
):
language
=
create_language
(
name
=
"
German
"
)
template_name
=
"
german_template
"
template_file
=
get_resource_path
(
'
upcoming_appointment_FR.docx
'
)
self
.
study_subject
.
subject
.
default_written_communication_language
=
language
self
.
study_subject
.
subject
.
save
()
MailTemplate
(
name
=
template_name
,
language
=
language
,
context
=
MAIL_TEMPLATE_CONTEXT_SUBJECT
,
template_file
=
template_file
).
save
()
response
=
self
.
client
.
get
(
reverse
(
'
web.views.subject_edit
'
,
kwargs
=
{
'
id
'
:
self
.
study_subject
.
id
}))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTrue
(
template_name
in
response
.
content
)
def
test_render_subject_visit_details
(
self
):
def
test_render_subject_visit_details
(
self
):
visit
=
create_visit
(
self
.
study_subject
)
visit
=
create_visit
(
self
.
study_subject
)
create_appointment
(
visit
)
create_appointment
(
visit
)
...
...
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