Skip to content
Snippets Groups Projects
Commit b02dc372 authored by Chris Pastl's avatar Chris Pastl
Browse files

Test: add ChannelFactory and PlayoutStatusResponse tests

parent 6da0b44d
No related branches found
No related tags found
1 merge request!36Improve test coverage #137
Pipeline #7892 failed
...@@ -26,6 +26,7 @@ from aura_engine.core.channels import ( ...@@ -26,6 +26,7 @@ from aura_engine.core.channels import (
ChannelFactory, ChannelFactory,
ChannelName, ChannelName,
LineChannel, LineChannel,
PlayoutStatusResponse,
QueueChannel, QueueChannel,
StreamChannel, StreamChannel,
) )
...@@ -53,20 +54,66 @@ class TestChannelFactory(unittest.TestCase): ...@@ -53,20 +54,66 @@ class TestChannelFactory(unittest.TestCase):
self.mixer = client.mixer self.mixer = client.mixer
self.factory = ChannelFactory(self.mixer) self.factory = ChannelFactory(self.mixer)
def test_create_channel_load(self): def create_channels(self):
queue = self.factory.create_channel(0, ChannelName.QUEUE_A, self.mixer)
stream = self.factory.create_channel(0, ChannelName.HTTP_A, self.mixer)
live = self.factory.create_channel(0, ChannelName.LIVE_0, self.mixer)
return (queue, stream, live)
def test_create_channel(self):
print(self._testMethodName)
queue, stream, live = self.create_channels()
self.assertEqual(type(queue), QueueChannel)
self.assertEqual(type(stream), StreamChannel)
self.assertEqual(type(live), LineChannel)
def test_load(self):
print(self._testMethodName) print(self._testMethodName)
queue, stream, live = self.create_channels()
queue.load()
stream.load("http://foo")
live.load()
queue_channel = self.factory.create_channel(0, ChannelName.QUEUE_A, self.mixer) def test_fade_in(self):
stream_channel = self.factory.create_channel(0, ChannelName.HTTP_A, self.mixer) print(self._testMethodName)
live_channel = self.factory.create_channel(0, ChannelName.LIVE_0, self.mixer) queue, stream, live = self.create_channels()
queue.fade_in(volume=100)
stream.fade_in(volume=100)
live.fade_in(volume=100)
def test_fade_out(self):
print(self._testMethodName)
queue, stream, live = self.create_channels()
queue.fade_out()
stream.fade_out()
live.fade_out()
self.assertEqual(type(queue_channel), QueueChannel)
self.assertEqual(type(stream_channel), StreamChannel)
self.assertEqual(type(live_channel), LineChannel)
queue_channel.load() class TestPlayoutStatusResponse(unittest.TestCase):
stream_channel.load("http://foo") """
live_channel.load() Testing the PlayoutStatusResponse.
"""
def test_enum(self):
print(self._testMethodName)
# test string initializer
self.assertIs(
PlayoutStatusResponse("polling"), PlayoutStatusResponse.STREAM_STATUS_POLLING
)
self.assertIs(
PlayoutStatusResponse("stopped"), PlayoutStatusResponse.STREAM_STATUS_STOPPED
)
self.assertIs(
PlayoutStatusResponse("connected"), PlayoutStatusResponse.STREAM_STATUS_CONNECTED
)
# testing vice-versa due to list type for SUCCESS case
self.assertTrue("OK" in PlayoutStatusResponse.SUCCESS.value)
self.assertTrue("Done" in PlayoutStatusResponse.SUCCESS.value)
self.assertTrue("Done!" in PlayoutStatusResponse.SUCCESS.value)
self.assertTrue("Donee!" in PlayoutStatusResponse.SUCCESS.value)
self.assertTrue("mkay" not in PlayoutStatusResponse.SUCCESS.value)
if __name__ == "__main__": if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment