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
bed3e473
There was a problem fetching the pipeline metadata.
Commit
bed3e473
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
unit tests of redit appointment added
parent
99d288cf
No related branches found
No related tags found
1 merge request
!39
Subject additional fields added
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smash/web/tests/test_view_appointments.py
+26
-0
26 additions, 0 deletions
smash/web/tests/test_view_appointments.py
with
26 additions
and
0 deletions
smash/web/tests/test_view_appointments.py
+
26
−
0
View file @
bed3e473
...
...
@@ -5,6 +5,7 @@ from django.urls import reverse
from
functions
import
create_subject
,
create_visit
,
create_appointment
,
create_worker
from
web.forms
import
AppointmentEditForm
,
SubjectEditForm
from
web.models
import
Appointment
,
Subject
from
web.views.notifications
import
get_today_midnight_date
from
.
import
LoggedInTestCase
...
...
@@ -69,3 +70,28 @@ class AppointmentsViewTests(LoggedInTestCase):
reverse
(
'
web.views.appointment_edit
'
,
kwargs
=
{
'
id
'
:
appointment
.
id
}),
data
=
form_data
)
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_save_appointments_edit
(
self
):
subject
=
create_subject
()
create_worker
(
self
.
user
,
True
)
visit
=
create_visit
(
subject
)
appointment
=
create_appointment
(
visit
,
get_today_midnight_date
())
form_appointment
=
AppointmentEditForm
(
user
=
self
.
user
,
instance
=
appointment
,
prefix
=
"
appointment
"
)
form_subject
=
SubjectEditForm
(
instance
=
subject
,
prefix
=
"
subject
"
)
form_data
=
{}
for
key
,
value
in
form_appointment
.
initial
.
items
():
if
value
is
not
None
:
form_data
[
'
appointment-{}
'
.
format
(
key
)]
=
value
for
key
,
value
in
form_subject
.
initial
.
items
():
if
value
is
not
None
:
form_data
[
'
subject-{}
'
.
format
(
key
)]
=
value
form_data
[
"
appointment-status
"
]
=
Appointment
.
APPOINTMENT_STATUS_FINISHED
response
=
self
.
client
.
post
(
reverse
(
'
web.views.appointment_edit
'
,
kwargs
=
{
'
id
'
:
appointment
.
id
}),
data
=
form_data
)
self
.
assertEqual
(
response
.
status_code
,
302
)
updated_subject
=
Subject
.
objects
.
get
(
id
=
subject
.
id
)
self
.
assertTrue
(
updated_subject
.
information_sent
)
\ No newline at end of file
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