forked from rc/aircox
27 lines
779 B
Python
27 lines
779 B
Python
import pytest
|
|
import os
|
|
|
|
from aircox.conf import settings
|
|
|
|
from aircox.models import Station, Program
|
|
|
|
class TestProgramQuerySet:
|
|
@pytest.mark.django_db
|
|
def test_station(self, stations, programs):
|
|
programs_with_station_0 = Program.objects.station(station=stations[0])
|
|
|
|
assert programs[0] in programs_with_station_0
|
|
assert programs[2] not in programs_with_station_0
|
|
|
|
@pytest.mark.django_db
|
|
def test_active(self, programs):
|
|
active_programs = Program.objects.active()
|
|
|
|
assert active_programs[0].active == True
|
|
|
|
class TestProgram:
|
|
@pytest.mark.django_db
|
|
def test_path(self, program):
|
|
program_path = program.path
|
|
|
|
assert program_path == os.path.join(settings.PROGRAMS_DIR, program.slug.replace("-", "_")) |