Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
engine
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
engine
Commits
9602f3dc
Commit
9602f3dc
authored
1 year ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
test: get current item
parent
3d6e383b
No related branches found
No related tags found
1 merge request
!35
ORM-less scheduling
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_scheduling_timetable.py
+34
-1
34 additions, 1 deletion
tests/test_scheduling_timetable.py
with
34 additions
and
1 deletion
tests/test_scheduling_timetable.py
+
34
−
1
View file @
9602f3dc
...
@@ -28,7 +28,7 @@ from aura_engine.base.api import SimpleCachedRestApi
...
@@ -28,7 +28,7 @@ from aura_engine.base.api import SimpleCachedRestApi
from
aura_engine.base.config
import
AuraConfig
from
aura_engine.base.config
import
AuraConfig
from
aura_engine.base.utils
import
SimpleUtil
as
SU
from
aura_engine.base.utils
import
SimpleUtil
as
SU
from
aura_engine.scheduling.api
import
ApiFetcher
from
aura_engine.scheduling.api
import
ApiFetcher
from
aura_engine.scheduling.domain
import
PlaylistType
,
Timeslot
from
aura_engine.scheduling.domain
import
Playlist
,
PlaylistItem
,
PlaylistType
,
Timeslot
from
aura_engine.scheduling.programme
import
TimetableService
from
aura_engine.scheduling.programme
import
TimetableService
...
@@ -209,6 +209,38 @@ class TestSchedulingTimetable(unittest.TestCase):
...
@@ -209,6 +209,38 @@ class TestSchedulingTimetable(unittest.TestCase):
next
=
self
.
timetable
.
get_next_timeslots
()
next
=
self
.
timetable
.
get_next_timeslots
()
self
.
assertEqual
(
0
,
len
(
next
))
self
.
assertEqual
(
0
,
len
(
next
))
def
test_get_current_item
(
self
):
print
(
self
.
_testMethodName
)
now
=
SU
.
timestamp
()
ts1
=
Timeslot
(
id
=
1
,
repetition_id
=
None
,
start
=
now
-
180
,
end
=
now
-
120
,
show
=
None
,
episode
=
None
)
ts2
=
Timeslot
(
id
=
1
,
repetition_id
=
None
,
start
=
now
-
120
,
end
=
now
+
120
,
show
=
None
,
episode
=
None
)
ts3
=
Timeslot
(
id
=
1
,
repetition_id
=
None
,
start
=
now
+
120
,
end
=
now
+
180
,
show
=
None
,
episode
=
None
)
ts4
=
Timeslot
(
id
=
1
,
repetition_id
=
None
,
start
=
now
+
180
,
end
=
now
+
360
,
show
=
None
,
episode
=
None
)
pl
=
Playlist
(
"
999
"
,
"
Playlist X
"
,
False
)
alpha
=
PlaylistItem
(
"
alpha.flac
"
,
20
,
100
,
None
)
beta
=
PlaylistItem
(
"
beta.flac
"
,
100
,
100
,
None
)
gamma
=
PlaylistItem
(
"
gamma.flac
"
,
20
,
100
,
None
)
pl
.
add
(
alpha
)
pl
.
add
(
beta
)
pl
.
add
(
gamma
)
ts2
.
set_playlists
(
pl
,
None
,
None
)
self
.
timetable
.
timetable
=
[
ts1
,
ts2
,
ts3
,
ts4
]
current
=
self
.
timetable
.
get_current_item
()
print
(
f
"
Current item is
'
{
current
.
source
}
'"
)
self
.
assertEqual
(
beta
,
current
)
def
test_is_timeslot_in_window
(
self
):
def
test_is_timeslot_in_window
(
self
):
print
(
self
.
_testMethodName
)
print
(
self
.
_testMethodName
)
# Expecting a configured schedluing window of T1(-60) - T2(-60) seconds.
# Expecting a configured schedluing window of T1(-60) - T2(-60) seconds.
...
@@ -243,6 +275,7 @@ class TestSchedulingTimetable(unittest.TestCase):
...
@@ -243,6 +275,7 @@ class TestSchedulingTimetable(unittest.TestCase):
def
test_timetable_merge
(
self
):
def
test_timetable_merge
(
self
):
print
(
self
.
_testMethodName
)
print
(
self
.
_testMethodName
)
# @mock.patch("aura_engine.scheduling.programme.api_fetcher", side_effect=mocked_fetch)
@mock.patch
(
"
aura_engine.base.api.requests.get
"
,
side_effect
=
mocked_requests_get
)
@mock.patch
(
"
aura_engine.base.api.requests.get
"
,
side_effect
=
mocked_requests_get
)
def
test_fetch_data
(
self
,
mock_get
):
def
test_fetch_data
(
self
,
mock_get
):
print
(
self
.
_testMethodName
)
print
(
self
.
_testMethodName
)
...
...
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