def test_get_entries_incompatible_models(self): supported_model = MockUPNPEntry("desc_RX-V481.xml") devices = [supported_model, MockUPNPEntry("desc_R-N602.xml")] discoverable = Discoverable(None) discoverable.find_by_device_description = MagicMock( return_value=devices) self.assertEqual(discoverable.get_entries(), [supported_model])
def test_get_entries_incompatible_models(self): supported_model = MockUPNPEntry( "desc_multiple_services_no_remote_control.xml") devices = [ supported_model, MockUPNPEntry("desc_incompatible_device.xml") ] discoverable = Discoverable(None) discoverable.INCOMPATIBLE_MODELS = ["aaa"] discoverable.find_by_device_description = MagicMock( return_value=devices) self.assertEqual(discoverable.get_entries(), [supported_model])
def test_info_from_entry_multiple_services_no_remote_control(self): self.assertEqual( ("multi service friendly name", "multi service model name", "http://192.168.1.2:80/YamahaNewControl/ctrl", "http://192.168.1.2:80/YamahaNewControl/desc.xml"), Discoverable(None).info_from_entry( MockUPNPEntry("desc_multiple_services_no_remote_control.xml")))
def test_info_from_entry_single_service(self): self.assertEqual( ("single service friendly name", "single service model name", "http://192.168.1.2:80/YamahaRemoteControl/single_ctrl", "http://192.168.1.2:80/YamahaRemoteControl/single_desc.xml"), Discoverable(None).info_from_entry( MockUPNPEntry("desc_single_service.xml")))
def test_info_from_entry_rx_v481(self): self.assertEqual( ("RX-V481 XXXXXX", "RX-V481", "http://192.168.XXX.XXX:80/YamahaRemoteControl/ctrl", "http://192.168.XXX.XXX:80/YamahaRemoteControl/desc.xml"), Discoverable(None).info_from_entry( MockUPNPEntry("desc_RX-V481.xml")))
def test_info_from_entry_multiple_services_no_remote_control(self): self.assertEqual( Discoverable(None).info_from_entry( MockUPNPEntry("desc_multiple_services_no_remote_control.xml")), { 'control_url': 'http://192.168.1.2:80/YamahaNewControl/ctrl', 'description_url': 'http://192.168.1.2:80/YamahaNewControl/desc.xml', 'host': '192.168.xxx.xxx', 'model_name': 'multi service model name', 'model_number': None, 'name': 'multi service friendly name', 'port': 80, 'serial': None, 'ssdp_description': 'http://192.168.XXX.XXX:80/desc.xml' })
def test_info_from_entry_rx_v481(self): self.assertEqual( Discoverable(None).info_from_entry( MockUPNPEntry("desc_RX-V481.xml")), { 'control_url': 'http://192.168.XXX.XXX:80/YamahaRemoteControl/ctrl', 'description_url': 'http://192.168.XXX.XXX:80/YamahaRemoteControl/desc.xml', 'host': '192.168.xxx.xxx', 'model_name': 'RX-V481', 'model_number': 'V481', 'name': 'RX-V481 XXXXXX', 'port': 80, 'serial': 'XXXXXXXX', 'ssdp_description': 'http://192.168.XXX.XXX:80/desc.xml' })
def test_info_from_entry_single_service(self): self.assertEqual( Discoverable(None).info_from_entry( MockUPNPEntry("desc_single_service.xml")), { 'control_url': 'http://192.168.1.2:80/YamahaRemoteControl/single_ctrl', 'description_url': 'http://192.168.1.2:80/YamahaRemoteControl/single_desc.xml', 'host': '192.168.xxx.xxx', 'model_name': 'single service model name', 'model_number': None, 'manufacturer': None, 'name': 'single service friendly name', 'port': 80, 'serial': None, 'ssdp_description': 'http://192.168.XXX.XXX:80/desc.xml' })
def test_info_from_entry_rx_v481(self): self.assertEqual( Discoverable(None).info_from_entry( MockUPNPEntry("desc_RX-V481.xml")), { 'control_url': 'http://192.168.XXX.XXX:80/YamahaRemoteControl/ctrl', 'description_url': 'http://192.168.XXX.XXX:80/YamahaRemoteControl/desc.xml', 'host': '192.168.xxx.xxx', 'model_name': 'RX-V481', 'model_number': 'V481', 'manufacturer': 'Yamaha Corporation', 'name': 'RX-V481 XXXXXX', 'port': 80, 'serial': 'XXXXXXXX', 'ssdp_description': 'http://192.168.XXX.XXX:80/desc.xml', 'udn': 'uuid:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'upnp_device_type': 'urn:schemas-upnp-org:device:MediaRenderer:1', })
def test_info_from_entry_multiple_services_remote_control_last(self): self.assertEqual( Discoverable(None).info_from_entry( MockUPNPEntry( "desc_multiple_services_remote_control_last.xml")), { 'control_url': 'http://192.168.1.2:80/YamahaRemoteControl/multi_ctrl', 'description_url': 'http://192.168.1.2:80/YamahaRemoteControl/multi_desc.xml', 'host': '192.168.xxx.xxx', 'model_name': 'RX-V multi service model name', 'model_number': None, 'manufacturer': None, 'name': 'multi service friendly name', 'port': 80, 'serial': None, 'ssdp_description': 'http://192.168.XXX.XXX:80/desc.xml', 'udn': None, 'upnp_device_type': None, })