def test_tuners(self, tuner: MagicMock): main = Main(self.config) g1 = Geo() g2 = Geo() main.geos = [g1, g2] main._init_tuners() self.assertEqual(len(main.tuners), 2) tuner.assert_any_call(g1, main.config, main.ssdp, port=6077) tuner.assert_any_call(g1, main.config, main.ssdp, port=6078)
def test_override_zipcodes(self): self.config.override_location = None self.config.override_zipcodes = '90210,11011' main = Main(self.config) main._init_geos() self.assertEqual(len(main.geos), 2) self.assertEqual(main.geos[0], Geo('90210')) self.assertEqual(main.geos[1], Geo('11011'))
def test_tuners_multiplex(self, tuner: MagicMock): self.config.multiplex = True main = Main(self.config) g1 = Geo() g2 = Geo() main.geos = [g1, g2] main._init_tuners() self.assertEqual(len(main.tuners), 2) tuner.assert_any_call(g1, main.config, main.ssdp, port=None) tuner.assert_any_call(g2, main.config, main.ssdp, port=None)
def test_multiplex_debug(self, multiplexer: MagicMock): self.config.multiplex = True self.config.multiplex_debug = True main = Main(self.config) main.geos = [Geo()] main._init_multiplexer() multiplexer.assert_called_once_with(self.config, 6078, main.ssdp)
def test_override_none(self): self.config.override_location = None self.config.override_zipcodes = None main = Main(self.config) main._init_geos() self.assertEqual(len(main.geos), 1) self.assertEqual(main.geos[0], Geo())
def test_override_locations(self): self.config.override_location = '1.99,2.33' self.config.override_zipcodes = None main = Main(self.config) main._init_geos() geo = Geo(coords={'latitude': '1.99', 'longitude': '2.33'}) self.assertEqual(len(main.geos), 1) self.assertEqual(main.geos[0], geo)