class TestFritzXmlParser(unittest.TestCase): def setUp(self): self.fp = FritzXmlParser(None, None, filename=DESCRIPTION_FILE) self.namespace = 'urn:schemas-upnp-org:device-1-0' def test_namespace(self): self.assertEqual(self.namespace, self.fp.namespace) def test_nodename(self): self.assertEqual('{%s}%s' % (self.namespace, 'mynode'), self.fp.nodename('mynode'))
def action_test_connection(self, args): _logger.debug('Testing FritzBox connection...') connection = self.get_connection() _logger.debug('Service-Descriptions loaded') result = connection[0].call_action('X_AVM-DE_OnTel', 'GetPhonebook', NewPhonebookID=0) fxp = FritzXmlParser(url=result['NewPhonebookURL']) nodes = fxp.root.iterfind('.//contact') _logger.debug('Trying to print telephone-book:') for node in nodes: _logger.debug( '#%s %s: %s' % (node.find('uniqueid').text, node.find('person/realName').text, node.find('telephony/number').text))
def setUp(self): self.fp = FritzXmlParser(None, None, filename=DESCRIPTION_FILE) self.namespace = 'urn:schemas-upnp-org:device-1-0'