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