def test_generateXML(self): hashed = hashlib.md5("test").hexdigest() info = TimezoneInfo("America/New_York", ("US/Eastern",), "20110517T120000Z", hashed) node = Element("root") info.generateXML(node) timezone = node.find("timezone") self.assertTrue(timezone is not None) self.assertEqual(timezone.findtext("tzid"), "America/New_York") self.assertEqual(timezone.findtext("dtstamp"), "20110517T120000Z") self.assertEqual(timezone.findtext("alias"), "US/Eastern") self.assertEqual(timezone.findtext("md5"), hashed)
def test_parseXML(self): hashed = hashlib.md5("test").hexdigest() info1 = TimezoneInfo("America/New_York", ("US/Eastern",), "20110517T120000Z", hashed) node = Element("root") info1.generateXML(node) timezone = node.find("timezone") info2 = TimezoneInfo.readXML(timezone) self.assertEqual(info2.tzid, "America/New_York") self.assertEqual(info2.aliases, ("US/Eastern",)) self.assertEqual(info2.dtstamp, "20110517T120000Z") self.assertEqual(info2.md5, hashed)