Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
steering
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
AURA
steering
Commits
df39d43e
Verified
Commit
df39d43e
authored
8 months ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
test: update to the new route & fix playout tests
parent
5e7c20eb
No related branches found
No related tags found
1 merge request
!52
new program endpoint
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
program/tests/test_playout.py
+40
-16
40 additions, 16 deletions
program/tests/test_playout.py
with
40 additions
and
16 deletions
program/tests/test_playout.py
+
40
−
16
View file @
df39d43e
...
...
@@ -7,9 +7,9 @@ pytestmark = pytest.mark.django_db
def
url
(
include_virtual
=
False
):
if
include_virtual
:
return
"
/api/v1/playout/?include_virtual=true
"
return
"
/api/v1/
program/
playout/?include_virtual=true
"
return
"
/api/v1/playout/
"
return
"
/api/v1/
program/
playout/
"
def
create_daily_schedule
(
admin_api_client
,
daily_rrule
,
show
)
->
None
:
...
...
@@ -33,18 +33,41 @@ def create_daily_schedule(admin_api_client, daily_rrule, show) -> None:
admin_api_client
.
post
(
"
/api/v1/schedules/
"
,
data
=
data
,
format
=
"
json
"
)
def
assert_entry
(
entry
,
show
)
->
None
:
"""
asserts the playout entry corresponds to the given show.
"""
assert
entry
[
"
episode
"
]
assert
entry
[
"
schedule
"
]
assert
entry
[
"
show
"
]
assert
entry
[
"
timeslot
"
]
assert
entry
[
"
timeslotId
"
]
assert
entry
[
"
showId
"
]
==
entry
[
"
show
"
][
"
id
"
]
==
show
.
id
assert
entry
[
"
show
"
][
"
name
"
]
==
show
.
name
def
assert_virtual_entry
(
entry
,
fallback_show
)
->
None
:
"""
asserts the playout entry is virtual and corresponds to given fallback show.
"""
assert
entry
[
"
show
"
]
assert
not
entry
[
"
episode
"
]
assert
not
entry
[
"
schedule
"
]
assert
not
entry
[
"
timeslot
"
]
assert
not
entry
[
"
timeslotId
"
]
assert
entry
[
"
showId
"
]
==
entry
[
"
show
"
][
"
id
"
]
==
fallback_show
.
id
assert
entry
[
"
show
"
][
"
name
"
]
==
fallback_show
.
name
def
test_playout
(
admin_api_client
,
api_client
,
daily_rrule
,
show
):
create_daily_schedule
(
admin_api_client
,
daily_rrule
,
show
)
response
=
api_client
.
get
(
url
())
assert
response
.
status_code
==
200
assert
len
(
response
.
json
())
==
7
assert
len
(
response
.
json
())
==
1
for
entry
in
response
.
json
():
assert
not
entry
[
"
timeslot
"
][
"
isVirtual
"
]
assert
entry
[
"
show
"
][
"
id
"
]
==
show
.
id
assert
entry
[
"
show
"
][
"
name
"
]
==
show
.
name
assert_entry
(
response
.
json
()[
0
],
show
)
def
test_playout_include_virtual
(
...
...
@@ -60,12 +83,13 @@ def test_playout_include_virtual(
response
=
api_client
.
get
(
url
(
include_virtual
=
True
))
assert
response
.
status_code
==
200
assert
len
(
response
.
json
())
==
14
or
15
for
entry
in
response
.
json
():
if
entry
[
"
timeslot
"
][
"
isVirtual
"
]:
assert
entry
[
"
show
"
][
"
id
"
]
==
fallback_show
.
id
assert
entry
[
"
show
"
][
"
name
"
]
==
fallback_show
.
name
else
:
assert
entry
[
"
show
"
][
"
id
"
]
==
show
.
id
assert
entry
[
"
show
"
][
"
name
"
]
==
show
.
name
assert
len
(
response
.
json
())
==
3
virtual_entry1
,
entry
,
virtual_entry2
=
response
.
json
()
assert_virtual_entry
(
virtual_entry1
,
fallback_show
)
assert_entry
(
entry
,
show
)
assert_virtual_entry
(
virtual_entry2
,
fallback_show
)
assert
virtual_entry1
[
"
end
"
]
==
entry
[
"
start
"
]
assert
entry
[
"
end
"
]
==
virtual_entry2
[
"
start
"
]
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