Exemple #1
0
 def setUp(self) -> None:
     self.config = Configuration({
         "cache_stations":
         False,
         "uid":
         "2721c2f0-6f2a-11eb-8001-acde48001122"
     })
Exemple #2
0
 def setUp(self) -> None:
     self.config = Configuration({
         'verbose': 0,
         'logfile': None,
         'ssdp': True,
         'uid': None
     })
Exemple #3
0
 def setUp(self) -> None:
     self.config = Configuration({
         "bind_address": "5.4.3.2",
         "password": "******"
     })
     self.port = 6077
     self.locast_service = MagicMock()
Exemple #4
0
 def setUp(self) -> None:
     self.config = Configuration({
         'verbose': 0,
         'logfile': None,
         'username': '******',
         'password': '******'
     })
Exemple #5
0
 def setUp(self) -> None:
     self.config = Configuration({
         "device_model": "DEVICE_MODEL",
         "device_version": "1.23.4",
         "bind_address": "5.4.3.2",
         "device_firmware": "DEVICE_FIRMWARE",
         "tuner_count": 3,
         "multiplex": False,
         "direct": False
     })
     port = 6077
     self.locast_service = MagicMock()
     self.locast_service.city = "Chicago"
     self.locast_service.get_stations = MagicMock()
     self.locast_service.get_stations.return_value = [
         {
             "name": "NAME1",
             "callSign": "CBS",
             "city": "Chicago",
             "id": "1234",
             "channel": "1.1",
         },
         {
             "name": "2.1 NAME2",
             "city": "Chicago",
             "id": "4321",
             "channel": "2.1",
         }
     ]
     self.host_and_port = f'{self.config.bind_address}:{port}'
     app = HTTPInterface(
         self.config, port, "6c97580f-0440-5be6-a6ce-e648b59490b9", self.locast_service)
     app.config['DEBUG'] = True
     app.config['TESTING'] = True
     self.client = app.test_client()
Exemple #6
0
 def setUp(self) -> None:
     self.config = Configuration({
         'verbose': 0,
         'logfile': None,
         'multiplex': False,
         'multiplex_debug': False,
         'port': 6077
     })
Exemple #7
0
    def test_del_configuration(self):
        config = Configuration({"foo": "bar"})
        del config.foo
        with self.assertRaises(AttributeError):
            config.foo

        with self.assertRaises(AttributeError):
            del config.foo
Exemple #8
0
 def setUp(self) -> None:
     self.config = Configuration({
         'verbose': 0,
         'logfile': None,
         'bind_address': '1.2.3.4',
         'uid': "TEST",
         'remap': False,
         'uid': '2721c2f0-6f2a-11eb-8001-acde48001122',
     })
Exemple #9
0
    def setUp(self) -> None:

        self.config = Configuration({
            'verbose': 0,
            'logfile': None,
            'bind_address': '1.2.3.4',
            'ssdp': True,
            'http_threads': 5
        })
Exemple #10
0
    def test_no_verbose(self):
        config = Configuration({
            'verbose': 0
        })
        stderr = MagicMock()
        signal = MagicMock()
        signal.running = PropertyMock()

        _log_output(config, stderr, signal)

        stderr.readline.assert_not_called()
        signal.running.assert_not_called()
Exemple #11
0
 def setUp(self) -> None:
     self.config = Configuration({
         "bind_address": "5.4.3.2",
         "ffmpeg": "ffmpeg_bin",
         "bytes_per_read": 1024,
         "verbose": 0,
         "direct": False
     })
     self.port = 6077
     self.locast_service = MagicMock()
     self.locast_service.city = "Chicago"
     self.app = HTTPInterface(self.config, self.port,
                              "6c97580f-0440-5be6-a6ce-e648b59490b9", self.locast_service)
     self.client = self.app.test_client()
Exemple #12
0
    def test_verbose_exception(self, _readline: MagicMock, getLogger: MagicMock):
        config = Configuration({
            'verbose': 1
        })
        stderr = MagicMock()
        signal = MagicMock()
        signal.running = MagicMock()
        signal.running.side_effect = [True, False]
        _readline.side_effect = self.raise_exception
        getLogger.return_value = logger = MagicMock()

        _log_output(config, stderr, signal)

        getLogger.assert_called_once_with("ffmpeg")
        logger.info.assert_not_called()
        _readline.assert_called_with(stderr)
        signal.running.assert_called()
Exemple #13
0
 def setUp(self) -> None:
     self.config = Configuration({
         "cache_stations": True,
         "days": 8,
         "cache_timeout": 3600
     })
Exemple #14
0
 def setUp(self) -> None:
     self.config = Configuration({})
Exemple #15
0
 def setUp(self) -> None:
     self.config = Configuration({
         'bytes_per_read': 1024
     })
Exemple #16
0
 def test_set_configuration(self):
     config = Configuration({})
     config.foo = "bar"
     self.assertEqual(config.foo, "bar")
Exemple #17
0
 def setUp(self) -> None:
     self.config = Configuration({
         "device_model": "DEVICE_MODEL",
         "device_version": "1.23.4",
         "bind_address": "5.4.3.2",
         "device_firmware": "DEVICE_FIRMWARE",
         "tuner_count": 3
     })
     port = 6077
     self.locast_service = MagicMock()
     self.locast_service.city = "Chicago"
     self.locast_service.get_stations = MagicMock()
     self.locast_service.get_stations.return_value = [
         {
             "name": "NAME1",
             "callSign": "CALLSIGN1",
             "city": "Chicago",
             "timezone": "America/Chicago",
             "id": "1234",
             "channel": "1.1",
             "listings": [
                 {
                     "startTime": 1610582400000,
                     "duration": 1800,
                     "title": "ProgramTitle",
                     "description": "Program Description",
                     "releaseDate": 1161561600000,
                     "genres": "News",
                     "preferredImage": "http://programimage",
                     "preferredImageHeight": 360,
                     "preferredImageWidth": 240,
                     "videoProperties": "CC, HD 720p, HDTV, Stereo",
                 }
             ]
         },
         {
             "name": "2.1 NAME2",
             "city": "Chicago",
             "timezone": "America/Chicago",
             "id": "4321",
             "channel": "2.1",
             "listings": [
                 {
                     "startTime": 1610582400000,
                     "duration": 1800,
                     "title": "ProgramTitle",
                     "description": "Program Description",
                     "releaseDate": 1161561600000,
                     "genres": "horror, action",
                     "preferredImage": "http://programimage",
                     "preferredImageHeight": 360,
                     "preferredImageWidth": 240,
                     "episodeNumber": 10,
                     "seasonNumber": 2,
                     "videoProperties": "CC, Stereo"
                 }
             ]
         },
         {
             "name": "2.1 NAME2",
             "city": "Chicago",
             "timezone": "America/Chicago",
             "id": "4321",
             "channel": "2.1",
             "listings": [
                 {
                     "startTime": 1610582400000,
                     "duration": 1800,
                     "title": "ProgramTitle",
                     "description": "Program Description",
                     "releaseDate": 1161561600000,
                     "genres": "horror, action",
                     "preferredImage": "http://programimage",
                     "preferredImageHeight": 360,
                     "preferredImageWidth": 240,
                     "videoProperties": "CC, Stereo",
                     "airdate": 1610582400
                 }
             ]
         }
     ]
     self.host_and_port = f'{self.config.bind_address}:{port}'
     app = HTTPInterface(
         self.config, port, "6c97580f-0440-5be6-a6ce-e648b59490b9", self.locast_service)
     app.config['DEBUG'] = True
     app.config['TESTING'] = True
     self.client = app.test_client()
Exemple #18
0
    def test_get_configuration(self):
        args = {"key": "value", "another_key": "another_value"}

        config = Configuration(args)
        self.assertEqual(config.key, args["key"])
        self.assertEqual(config.another_key, args["another_key"])
Exemple #19
0
 def setUp(self) -> None:
     self.config = Configuration({"verbose": 0, "logfile": None})
Exemple #20
0
 def setUp(self) -> None:
     self.config = Configuration({'verbose': 0, 'logfile': None})
Exemple #21
0
 def setUp(self) -> None:
     self.config = Configuration({
         'verbose': 0,
         'logfile': None,
         'direct': False
     })
Exemple #22
0
 def setUp(self) -> None:
     self.config = Configuration({"days": 8})
Exemple #23
0
 def setUp(self) -> None:
     self.config = Configuration({
         'verbose': 0,
         'logfile': None,
         'bind_address': '1.2.3.4'
     })