chore: fixes after libretime_api rename

This commit is contained in:
jo 2021-12-24 00:04:30 +01:00 committed by Kyle Robbertze
parent 6de242db65
commit e84137a8ee
14 changed files with 50 additions and 50 deletions

View file

@ -2,7 +2,7 @@ from datetime import datetime, timedelta
from django.test import TestCase
from libretimeapi.models import Schedule, ShowInstance
from libretime_api.models import Schedule, ShowInstance
class TestSchedule(TestCase):

View file

@ -2,9 +2,9 @@ from django.apps import apps
from django.contrib.auth.models import Group
from rest_framework.test import APITestCase
from libretimeapi.models import User
from libretimeapi.models.user_constants import DJ, GUEST
from libretimeapi.permission_constants import GROUPS
from libretime_api.models import User
from libretime_api.models.user_constants import DJ, GUEST
from libretime_api.permission_constants import GROUPS
class TestUserManager(APITestCase):

View file

@ -6,13 +6,13 @@ from django.contrib.auth.models import AnonymousUser
from model_bakery import baker
from rest_framework.test import APIRequestFactory, APITestCase
from libretimeapi.models.user_constants import ADMIN, DJ, GUEST, PROGRAM_MANAGER
from libretimeapi.permission_constants import (
from libretime_api.models.user_constants import ADMIN, DJ, GUEST, PROGRAM_MANAGER
from libretime_api.permission_constants import (
DJ_PERMISSIONS,
GUEST_PERMISSIONS,
PROGRAM_MANAGER_PERMISSIONS,
)
from libretimeapi.permissions import IsSystemTokenOrUser
from libretime_api.permissions import IsSystemTokenOrUser
class TestIsSystemTokenOrUser(APITestCase):
@ -109,7 +109,7 @@ class TestPermissions(APITestCase):
first_name="test",
last_name="user",
)
f = baker.make("libretimeapi.File", owner=user)
f = baker.make("libretime_api.File", owner=user)
model = "files/{}".format(f.id)
path = self.path.format(model)
self.client.login(username="test-dj", password="test")
@ -125,7 +125,7 @@ class TestPermissions(APITestCase):
first_name="test",
last_name="user",
)
f = baker.make("libretimeapi.File")
f = baker.make("libretime_api.File")
model = "files/{}".format(f.id)
path = self.path.format(model)
self.client.login(username="test-dj", password="test")

View file

@ -7,7 +7,7 @@ from django.utils import dateparse
from model_bakery import baker
from rest_framework.test import APIRequestFactory, APITestCase
from libretimeapi.views import FileViewSet
from libretime_api.views import FileViewSet
class TestFileViewSet(APITestCase):
@ -30,11 +30,11 @@ class TestFileViewSet(APITestCase):
def test_exists(self):
music_dir = baker.make(
"libretimeapi.MusicDir",
"libretime_api.MusicDir",
directory=os.path.join(os.path.dirname(__file__), "resources"),
)
f = baker.make(
"libretimeapi.File",
"libretime_api.File",
directory=music_dir,
mime="audio/mp3",
filepath="song.mp3",
@ -53,11 +53,11 @@ class TestScheduleViewSet(APITestCase):
def test_schedule_item_full_length(self):
music_dir = baker.make(
"libretimeapi.MusicDir",
"libretime_api.MusicDir",
directory=os.path.join(os.path.dirname(__file__), "resources"),
)
f = baker.make(
"libretimeapi.File",
"libretime_api.File",
directory=music_dir,
mime="audio/mp3",
filepath="song.mp3",
@ -66,12 +66,12 @@ class TestScheduleViewSet(APITestCase):
cueout=timedelta(seconds=40.8131),
)
show = baker.make(
"libretimeapi.ShowInstance",
"libretime_api.ShowInstance",
starts=datetime.now(tz=timezone.utc) - timedelta(minutes=5),
ends=datetime.now(tz=timezone.utc) + timedelta(minutes=5),
)
scheduleItem = baker.make(
"libretimeapi.Schedule",
"libretime_api.Schedule",
starts=datetime.now(tz=timezone.utc),
ends=datetime.now(tz=timezone.utc) + f.length,
cue_out=f.cueout,
@ -87,11 +87,11 @@ class TestScheduleViewSet(APITestCase):
def test_schedule_item_trunc(self):
music_dir = baker.make(
"libretimeapi.MusicDir",
"libretime_api.MusicDir",
directory=os.path.join(os.path.dirname(__file__), "resources"),
)
f = baker.make(
"libretimeapi.File",
"libretime_api.File",
directory=music_dir,
mime="audio/mp3",
filepath="song.mp3",
@ -100,12 +100,12 @@ class TestScheduleViewSet(APITestCase):
cueout=timedelta(seconds=40.8131),
)
show = baker.make(
"libretimeapi.ShowInstance",
"libretime_api.ShowInstance",
starts=datetime.now(tz=timezone.utc) - timedelta(minutes=5),
ends=datetime.now(tz=timezone.utc) + timedelta(seconds=20),
)
scheduleItem = baker.make(
"libretimeapi.Schedule",
"libretime_api.Schedule",
starts=datetime.now(tz=timezone.utc),
ends=datetime.now(tz=timezone.utc) + f.length,
instance=show,
@ -124,11 +124,11 @@ class TestScheduleViewSet(APITestCase):
def test_schedule_item_invalid(self):
music_dir = baker.make(
"libretimeapi.MusicDir",
"libretime_api.MusicDir",
directory=os.path.join(os.path.dirname(__file__), "resources"),
)
f = baker.make(
"libretimeapi.File",
"libretime_api.File",
directory=music_dir,
mime="audio/mp3",
filepath="song.mp3",
@ -137,12 +137,12 @@ class TestScheduleViewSet(APITestCase):
cueout=timedelta(seconds=40.8131),
)
show = baker.make(
"libretimeapi.ShowInstance",
"libretime_api.ShowInstance",
starts=datetime.now(tz=timezone.utc) - timedelta(minutes=5),
ends=datetime.now(tz=timezone.utc) + timedelta(minutes=5),
)
scheduleItem = baker.make(
"libretimeapi.Schedule",
"libretime_api.Schedule",
starts=datetime.now(tz=timezone.utc),
ends=datetime.now(tz=timezone.utc) + f.length,
cue_out=f.cueout,
@ -150,7 +150,7 @@ class TestScheduleViewSet(APITestCase):
file=f,
)
invalidScheduleItem = baker.make(
"libretimeapi.Schedule",
"libretime_api.Schedule",
starts=show.ends + timedelta(minutes=1),
ends=show.ends + timedelta(minutes=1) + f.length,
cue_out=f.cueout,
@ -168,11 +168,11 @@ class TestScheduleViewSet(APITestCase):
def test_schedule_item_range(self):
music_dir = baker.make(
"libretimeapi.MusicDir",
"libretime_api.MusicDir",
directory=os.path.join(os.path.dirname(__file__), "resources"),
)
f = baker.make(
"libretimeapi.File",
"libretime_api.File",
directory=music_dir,
mime="audio/mp3",
filepath="song.mp3",
@ -183,12 +183,12 @@ class TestScheduleViewSet(APITestCase):
filter_point = datetime.now(tz=timezone.utc)
show = baker.make(
"libretimeapi.ShowInstance",
"libretime_api.ShowInstance",
starts=filter_point - timedelta(minutes=5),
ends=filter_point + timedelta(minutes=5),
)
schedule_item = baker.make(
"libretimeapi.Schedule",
"libretime_api.Schedule",
starts=filter_point,
ends=filter_point + f.length,
cue_out=f.cueout,
@ -196,7 +196,7 @@ class TestScheduleViewSet(APITestCase):
file=f,
)
previous_item = baker.make(
"libretimeapi.Schedule",
"libretime_api.Schedule",
starts=filter_point - timedelta(minutes=5),
ends=filter_point - timedelta(minutes=5) + f.length,
cue_out=f.cueout,