Merge branch 'develop-1.0' of git.radiocampus.be:rc/aircox into develop-1.0
This commit is contained in:
commit
87394c2955
|
@ -66,7 +66,7 @@ class Episode(Page):
|
|||
)
|
||||
|
||||
@classmethod
|
||||
def get_init_kwargs_from(cls, page, date, title=None, **kwargs):
|
||||
def get_init_kwargs_from(cls, page, date=None, title=None, **kwargs):
|
||||
"""Get default Episode's title."""
|
||||
title = (
|
||||
settings.EPISODE_TITLE.format(
|
||||
|
|
|
@ -49,7 +49,7 @@ class Schedule(Rerun):
|
|||
)
|
||||
timezone = models.CharField(
|
||||
_("timezone"),
|
||||
default=lambda: tz.get_current_timezone().zone,
|
||||
default=lambda: tz.get_current_timezone().key,
|
||||
max_length=100,
|
||||
choices=[(x, x) for x in pytz.all_timezones],
|
||||
help_text=_("timezone used for the date"),
|
||||
|
|
|
@ -9,7 +9,7 @@ from aircox import models
|
|||
|
||||
@pytest.fixture
|
||||
def stations():
|
||||
return baker.make("aircox.station", _quantity=2)
|
||||
return baker.make(models.Station, _quantity=2)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -17,7 +17,9 @@ def programs(stations):
|
|||
items = list(
|
||||
itertools.chain(
|
||||
*(
|
||||
baker.make("aircox.program", station=station, _quantity=3)
|
||||
baker.make(
|
||||
models.Program, station=station, cover=None, _quantity=2
|
||||
)
|
||||
for station in stations
|
||||
)
|
||||
)
|
||||
|
@ -27,12 +29,17 @@ def programs(stations):
|
|||
return items
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def program(programs):
|
||||
return programs[0]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sched_initials(programs):
|
||||
# use concrete class; timezone is provided in order to ensure DST
|
||||
items = [
|
||||
baker.prepare(
|
||||
"aircox.schedule",
|
||||
models.Schedule,
|
||||
program=program,
|
||||
time=time(16, 00),
|
||||
timezone="Europe/Brussels",
|
||||
|
@ -48,7 +55,7 @@ def sched_reruns(sched_initials):
|
|||
# use concrete class
|
||||
items = [
|
||||
baker.prepare(
|
||||
"aircox.schedule",
|
||||
models.Schedule,
|
||||
initial=initial,
|
||||
program=initial.program,
|
||||
date=initial.date,
|
||||
|
@ -68,5 +75,28 @@ def schedules(sched_initials, sched_reruns):
|
|||
@pytest.fixture
|
||||
def episodes(programs):
|
||||
return [
|
||||
baker.make("aircox.episode", parent=program) for program in programs
|
||||
baker.make(models.Episode, parent=program, cover=None)
|
||||
for program in programs
|
||||
]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def episode(episodes):
|
||||
return episodes[0]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def podcasts(episodes):
|
||||
items = []
|
||||
for episode in episodes:
|
||||
sounds = baker.prepare(
|
||||
models.Sound,
|
||||
episode=episode,
|
||||
program=episode.program,
|
||||
is_public=True,
|
||||
_quantity=2,
|
||||
)
|
||||
for i, sound in enumerate(sounds):
|
||||
sound.file = f"test_sound_{episode.pk}_{i}.mp3"
|
||||
items += sounds
|
||||
return items
|
||||
|
|
Loading…
Reference in New Issue
Block a user