forked from rc/aircox
feat: test middleware; use zoneinfo; fix datetime warnings
This commit is contained in:
@@ -2,6 +2,7 @@ from datetime import time, timedelta
|
||||
import itertools
|
||||
import logging
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.test import RequestFactory
|
||||
|
||||
@@ -16,6 +17,12 @@ req_factory = RequestFactory()
|
||||
"""Request Factory used among different tests."""
|
||||
|
||||
|
||||
settings.ALLOWED_HOSTS = list(settings.ALLOWED_HOSTS) + [
|
||||
"sub.server.org",
|
||||
"server.org",
|
||||
]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def staff_user():
|
||||
return baker.make(User, is_active=True, is_staff=True)
|
||||
@@ -31,12 +38,23 @@ def logger():
|
||||
|
||||
@pytest.fixture
|
||||
def station():
|
||||
return baker.make(models.Station, audio_streams="stream 1\nstream 2")
|
||||
return baker.make(
|
||||
models.Station,
|
||||
hosts="server.org",
|
||||
audio_streams="stream 1\nstream 2",
|
||||
default=True,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def stations(station):
|
||||
return [station, baker.make(models.Station)]
|
||||
def sub_station():
|
||||
"""Non-default station."""
|
||||
return baker.make(models.Station, hosts="sub.server.org", default=False)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def stations(station, sub_station):
|
||||
return [station, sub_station]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
Reference in New Issue
Block a user