def test_build_empty(self): payload = VersionPayload() self.assertIsNone(payload.name) self.assertIsNone(payload.version) self.assertIsNone(payload.os_name) element = payload.as_xml() self.assertEqual(element.tag, "{jabber:iq:version}query") self.assertEqual(len(element), 0)
def test_parse_full(self): element = ElementTree.XML(IQ2) payload = VersionPayload.from_xml(element[0]) self.assertEqual(payload.name, "NAME") self.assertEqual(payload.version, "VERSION") self.assertEqual(payload.os_name, "OS")
def test_parse_empty(self): element = ElementTree.XML(IQ1) payload = VersionPayload.from_xml(element[0]) self.assertIsNone(payload.name) self.assertIsNone(payload.version) self.assertIsNone(payload.os_name)
def test_parse_full(self): element = ElementTree.XML(IQ2) payload = VersionPayload.from_xml(element[0]) self.assertEqual(payload.name, 'NAME') self.assertEqual(payload.version, 'VERSION') self.assertEqual(payload.os_name, 'OS')