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
0dbdadcc
Commit
0dbdadcc
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
unit test checking if column list generation is done properly
parent
2461fb76
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!111
Resolve "Unfinished appointments"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smash/web/tests/api_views/test_appointment.py
+35
-1
35 additions, 1 deletion
smash/web/tests/api_views/test_appointment.py
with
35 additions
and
1 deletion
smash/web/tests/api_views/test_appointment.py
+
35
−
1
View file @
0dbdadcc
# coding=utf-8
# coding=utf-8
import
datetime
import
datetime
import
json
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
django.test
import
Client
from
django.test
import
Client
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.urls
import
reverse
from
django.urls
import
reverse
from
web.models
import
AppointmentTypeLink
from
web.models
import
AppointmentTypeLink
,
AppointmentList
from
web.tests.functions
import
create_study_subject
,
create_worker
,
create_visit
,
create_appointment
,
\
from
web.tests.functions
import
create_study_subject
,
create_worker
,
create_visit
,
create_appointment
,
\
create_appointment_type
,
create_get_suffix
,
create_flying_team
create_appointment_type
,
create_get_suffix
,
create_flying_team
from
web.views.appointment
import
APPOINTMENT_LIST_GENERIC
,
APPOINTMENT_LIST_APPROACHING
,
APPOINTMENT_LIST_UNFINISHED
from
web.views.appointment
import
APPOINTMENT_LIST_GENERIC
,
APPOINTMENT_LIST_APPROACHING
,
APPOINTMENT_LIST_UNFINISHED
...
@@ -115,3 +116,36 @@ class TestAppointmentApi(TestCase):
...
@@ -115,3 +116,36 @@ class TestAppointmentApi(TestCase):
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTrue
(
name
in
response
.
content
)
self
.
assertTrue
(
name
in
response
.
content
)
def
test_get_columns
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'
web.api.appointments.columns
'
,
kwargs
=
{
'
appointment_list_type
'
:
APPOINTMENT_LIST_GENERIC
}))
self
.
assertEqual
(
response
.
status_code
,
200
)
columns
=
json
.
loads
(
response
.
content
)[
'
columns
'
]
visible_columns
=
0
for
column
in
columns
:
if
column
[
"
visible
"
]:
visible_columns
+=
1
self
.
assertTrue
(
visible_columns
>
0
)
def
test_get_columns_for_require_contact
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'
web.api.appointments.columns
'
,
kwargs
=
{
'
appointment_list_type
'
:
APPOINTMENT_LIST_UNFINISHED
}))
self
.
assertEqual
(
response
.
status_code
,
200
)
columns
=
json
.
loads
(
response
.
content
)[
'
columns
'
]
visible_columns
=
0
for
column
in
columns
:
if
column
[
"
visible
"
]:
visible_columns
+=
1
self
.
assertTrue
(
visible_columns
>
0
)
def
test_get_columns_when_no_list_is_available
(
self
):
AppointmentList
.
objects
.
all
().
delete
()
response
=
self
.
client
.
get
(
reverse
(
'
web.api.appointments.columns
'
,
kwargs
=
{
'
appointment_list_type
'
:
APPOINTMENT_LIST_GENERIC
}))
self
.
assertEqual
(
response
.
status_code
,
200
)
columns
=
json
.
loads
(
response
.
content
)[
'
columns
'
]
self
.
assertTrue
(
len
(
columns
)
>
0
)
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