aircox/aircox_streamer/tests/test_controllers_sources.py

82 lines
1.8 KiB
Python

import pytest
from aircox_streamer.controllers import Source
@pytest.fixture
def source(controller):
return Source(controller, 13)
class TestSource:
@pytest.mark.django_db
def test_station(self, source, station):
assert source.station == station
@pytest.mark.django_db
def test_fetch(self, socket, source, metadata_string):
remaining = 3.12
socket.recv_data = [
f"{remaining} END",
metadata_string,
]
source.fetch()
assert f"{source.id}.remaining" in socket.sent_data
assert f"{source.id}.get" in socket.sent_data
assert source.remaining == remaining
assert source["request_uri"]
@pytest.mark.django_db
def test_skip(self, socket, source):
source.skip()
assert f"{source.id}.skip" in socket.sent_data
@pytest.mark.django_db
def test_restart(self, socket, source):
source.skip()
prefix = f"{source.id}.seek"
assert any(r for r in socket.sent_data if r.startswith(prefix))
@pytest.mark.django_db
def test_seek(self, socket, source):
source.seek(10)
assert f"{source.id}.skip 10" in socket.sent_data
class TestPlaylistSource:
@pytest.mark.django_db
def test_get_sound_queryset(self):
pass
@pytest.mark.django_db
def test_get_playlist(self):
pass
@pytest.mark.django_db
def test_write_playlist(self):
pass
@pytest.mark.django_db
def test_stream(self):
pass
@pytest.mark.django_db
def test_sync(self):
pass
class TestQueueSource:
@pytest.mark.django_db
def test_push(self):
pass
@pytest.mark.django_db
def test_fetch(self):
pass
@pytest.mark.django_db
def test_requests(self):
pass