__author__ = 'dev'

import unittest
from web_streams.web_stream_player import WebStreamPlayer


class TestWebStreamPlayer(unittest.TestCase):

    def setUp(self):
        self.__player = WebStreamPlayer()
        self.__stream_name = "skaworld"
        self.__wrong_stream_name = "skawrld"

    def tearDown(self):
        self.__player.stop_stream()

    def test_play_stream(self):
        self.__player.play_stream(self.__stream_name)
        self.assertEqual(self.__player.get_current_stream_name(), self.__stream_name)

    def test_play_stream_error_wrong_stream_name(self):
        self.__player.play_stream(self.__wrong_stream_name)
        self.assertEqual(self.__player.get_current_stream_name(), None)

    def test_stop_stream(self):
        self.__player.play_stream(self.__stream_name)
        self.assertEqual(self.__player.get_current_stream_name(), self.__stream_name)
        self.__player.stop_stream()
        self.assertEqual(self.__player.get_current_stream_name(), None)


if __name__ == '__main__':
    unittest.main()
