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
c6dab981
Commit
c6dab981
authored
3 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
test for the bug
parent
5b5e28fe
No related branches found
Branches containing commit
Tags
v4.5.0
Tags containing commit
1 merge request
!333
consider the case that an appoinment is not set to a particular visit. the...
Pipeline
#45580
passed
3 years ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
smash/web/models/mail_template.py
+1
-1
1 addition, 1 deletion
smash/web/models/mail_template.py
smash/web/tests/models/test_mail_template.py
+21
-2
21 additions, 2 deletions
smash/web/tests/models/test_mail_template.py
with
22 additions
and
3 deletions
smash/web/models/mail_template.py
+
1
−
1
View file @
c6dab981
...
...
@@ -215,7 +215,7 @@ class MailTemplate(models.Model):
if
isinstance
(
instance
,
Appointment
):
appointment
=
instance
visit
=
instance
.
visit
#general appointment case
#
general appointment case
if
visit
is
not
None
:
study_subject
=
visit
.
subject
elif
isinstance
(
instance
,
Visit
):
...
...
This diff is collapsed.
Click to expand it.
smash/web/tests/models/test_mail_template.py
+
21
−
2
View file @
c6dab981
...
...
@@ -4,14 +4,14 @@ import io
from
django.test
import
TestCase
from
docx
import
Document
from
web.models
import
MailTemplate
,
StudySubject
,
Language
from
web.models
import
MailTemplate
,
StudySubject
,
Language
,
Appointment
from
web.models.constants
import
MAIL_TEMPLATE_CONTEXT_APPOINTMENT
,
MAIL_TEMPLATE_CONTEXT_VISIT
,
\
MAIL_TEMPLATE_CONTEXT_SUBJECT
,
MAIL_TEMPLATE_CONTEXT_VOUCHER
,
CUSTOM_FIELD_TYPE_TEXT
from
web.models.custom_data
import
CustomStudySubjectField
from
web.models.mail_template
import
DATE_FORMAT_SHORT
from
web.tests.functions
import
create_language
,
get_resource_path
,
create_appointment
,
create_user
,
\
create_study_subject
,
\
create_visit
,
create_voucher
,
create_worker
,
create_flying_team
,
get_test_study
create_visit
,
create_voucher
,
create_worker
,
create_flying_team
,
get_test_study
,
get_test_location
class
MailTemplateModelTests
(
TestCase
):
...
...
@@ -270,3 +270,22 @@ class MailTemplateModelTests(TestCase):
worker
=
create_worker
()
result
=
MailTemplate
.
get_generic_replacements
(
worker
)
self
.
assertEqual
(
result
[
'
##WORKER_EMAIL##
'
],
worker
.
email
)
def
test_apply_general_appointment
(
self
):
appointment
=
Appointment
.
objects
.
create
(
length
=
30
,
location
=
get_test_location
(),
status
=
Appointment
.
APPOINTMENT_STATUS_SCHEDULED
)
template_name_french
=
"
test_fr
"
appointment_template_french
=
MailTemplate
(
name
=
template_name_french
,
language
=
self
.
french_language
,
context
=
MAIL_TEMPLATE_CONTEXT_APPOINTMENT
,
template_file
=
self
.
template_file
)
stream
=
io
.
BytesIO
()
appointment_template_french
.
apply
(
appointment
,
self
.
user
,
stream
)
doc
=
Document
(
stream
)
worker_name
=
str
(
self
.
user
.
worker
)
location
=
appointment
.
location
.
name
self
.
check_doc_contains
(
doc
,
[
worker_name
,
location
])
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