def test_report_with_multiplexer(self): main = Main(self.config) main.multiplexer = MagicMock() tuner1 = MagicMock(spec=Tuner) tuner1.city = "TestTown" tuner1.zipcode = "111111" tuner1.dma = "373" tuner1.uid = "TEST_0" tuner1.url = None tuner2 = MagicMock(spec=Tuner) tuner2.city = "TestTown2" tuner2.zipcode = "111112" tuner2.dma = "372" tuner2.uid = "TEST_1" tuner2.url = "http://localhost:6789" main.tuners = [tuner1, tuner2] main.log = MagicMock() main.multiplexer.url = "http://localhost:7890" main.multiplexer.uid = "MULTI" main._report() self.assertEqual(len(main.log.info.mock_calls), 10)
def test_startup_with_multiplexer(self, *args): with patch.multiple('locast2dvr.main.Main', _login=MagicMock(return_value='New_Key'), _init_geos=MagicMock(), _init_multiplexer=MagicMock(), _init_tuners=MagicMock(), _check_ffmpeg=MagicMock(), _report=MagicMock()): main = Main(self.config) tuners = [MagicMock(), MagicMock()] main.tuners = tuners main.multiplexer = MagicMock() main.start()
def test_startup_no_ssdp(self, ssdp_server: MagicMock): self.config.ssdp = False with patch.multiple('locast2dvr.main.Main', _login=MagicMock(return_value='New_Key'), _init_geos=MagicMock(), _init_multiplexer=MagicMock(), _init_tuners=MagicMock(), _check_ffmpeg=MagicMock(), _report=MagicMock()): main = Main(self.config) tuners = [MagicMock(), MagicMock()] main.tuners = tuners main.multiplexer = MagicMock() ssdp_server.return_value = ssdp_instance = MagicMock() main.start() ssdp_instance.start.assert_not_called()