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
09b50b26
Verified
Commit
09b50b26
authored
9 months ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
test: move create_daily_schedule -> conftest to avoid repetition
parent
df39d43e
No related branches found
No related tags found
1 merge request
!52
new program endpoint
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
conftest.py
+21
-0
21 additions, 0 deletions
conftest.py
program/tests/test_playout.py
+2
-23
2 additions, 23 deletions
program/tests/test_playout.py
with
23 additions
and
23 deletions
conftest.py
+
21
−
0
View file @
09b50b26
...
...
@@ -57,6 +57,27 @@ def assert_data(response, data) -> None:
assert
response
.
data
[
key
]
==
value
def
create_daily_schedule
(
admin_api_client
,
daily_rrule
,
show
)
->
None
:
"""
creates a schedule for a show that repeats daily using the REST API.
"""
now
=
datetime
.
now
()
in_one_hour
=
now
+
timedelta
(
hours
=
1
)
in_seven_days
=
now
+
timedelta
(
days
=
7
)
data
=
{
"
schedule
"
:
{
"
end_time
"
:
in_one_hour
.
strftime
(
"
%H:%M:%S
"
),
"
first_date
"
:
now
.
strftime
(
"
%Y-%m-%d
"
),
"
last_date
"
:
in_seven_days
.
strftime
(
"
%Y-%m-%d
"
),
"
rrule_id
"
:
daily_rrule
.
id
,
"
show_id
"
:
show
.
id
,
"
start_time
"
:
now
.
strftime
(
"
%H:%M:%S
"
),
}
}
admin_api_client
.
post
(
"
/api/v1/schedules/
"
,
data
=
data
,
format
=
"
json
"
)
@pytest.fixture
def
profile
()
->
Profile
:
return
ProfileFactory
()
...
...
This diff is collapsed.
Click to expand it.
program/tests/test_playout.py
+
2
−
23
View file @
09b50b26
from
datetime
import
datetime
,
timedelta
import
pytest
from
conftest
import
create_daily_schedule
pytestmark
=
pytest
.
mark
.
django_db
...
...
@@ -12,27 +12,6 @@ def url(include_virtual=False):
return
"
/api/v1/program/playout/
"
def
create_daily_schedule
(
admin_api_client
,
daily_rrule
,
show
)
->
None
:
"""
creates a schedule for a show that repeats daily using the REST API.
"""
now
=
datetime
.
now
()
in_one_hour
=
now
+
timedelta
(
hours
=
1
)
in_seven_days
=
now
+
timedelta
(
days
=
7
)
data
=
{
"
schedule
"
:
{
"
end_time
"
:
in_one_hour
.
strftime
(
"
%H:%M:%S
"
),
"
first_date
"
:
now
.
strftime
(
"
%Y-%m-%d
"
),
"
last_date
"
:
in_seven_days
.
strftime
(
"
%Y-%m-%d
"
),
"
rrule_id
"
:
daily_rrule
.
id
,
"
show_id
"
:
show
.
id
,
"
start_time
"
:
now
.
strftime
(
"
%H:%M:%S
"
),
}
}
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.
"""
...
...
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