tests: admin_site, views.mixin, views.base, views.converters

This commit is contained in:
bkfox
2023-06-30 15:20:30 +02:00
parent 4aea8b281f
commit 3e6a86a813
8 changed files with 31 additions and 57 deletions

View File

@@ -3,6 +3,7 @@ import itertools
import logging
from django.contrib.auth.models import User
from django.test import RequestFactory
import pytest
from model_bakery import baker
@@ -11,6 +12,10 @@ from aircox import models
from aircox.test import Interface
req_factory = RequestFactory()
"""Request Factory used among different tests."""
@pytest.fixture
def staff_user():
return baker.make(User, is_active=True, is_staff=True)
@@ -25,8 +30,13 @@ def logger():
@pytest.fixture
def stations():
return baker.make(models.Station, _quantity=2)
def station():
return baker.make(models.Station, audio_streams="stream 1\nstream 2")
@pytest.fixture
def stations(station):
return [station, baker.make(models.Station)]
@pytest.fixture
@@ -35,7 +45,11 @@ def programs(stations):
itertools.chain(
*(
baker.make(
models.Program, station=station, cover=None, _quantity=2
models.Program,
station=station,
cover=None,
status=models.Program.STATUS_PUBLISHED,
_quantity=2,
)
for station in stations
)