def testToAndFromString(self): self.assert_(len(self.feed.entry) == 1) for entry in self.feed.entry: self.assert_(isinstance(entry, webmastertools.SitesEntry)) new_feed = webmastertools.SitesFeedFromString(self.feed.ToString()) self.assert_(len(new_feed.entry) == 1) for entry in new_feed.entry: self.assert_(isinstance(entry, webmastertools.SitesEntry))
def testConvertActualData(self): feed = webmastertools.SitesFeedFromString(test_data.SITES_FEED) self.assert_(len(feed.entry) == 1) entry = feed.entry[0] self.assert_(isinstance(entry, webmastertools.SitesEntry)) self.assert_(entry.indexed.text == 'true') self.assert_(entry.crawled.text == '2008-09-14T08:59:28.000') self.assert_(entry.geolocation.text == 'US') self.assert_(entry.preferred_domain.text == 'none') self.assert_(entry.crawl_rate.text == 'normal') self.assert_(entry.enhanced_image_search.text == 'true') self.assert_(entry.verified.text == 'false')
def testConvertActualData(self): feed = webmastertools.SitesFeedFromString(test_data.SITES_FEED) self.assertTrue(len(feed.entry[0].verification_method) == 2) check = 0 for method in feed.entry[0].verification_method: self.assertTrue(isinstance(method, webmastertools.VerificationMethod)) if method.type == 'metatag': self.assertTrue(method.in_use == 'false') self.assertTrue(method.text is None) self.assertTrue(method.meta.name == 'verify-v1') self.assertTrue(method.meta.content == 'a2Ai') check = check | 1 elif method.type == 'htmlpage': self.assertTrue(method.in_use == 'false') self.assertTrue(method.text == '456456-google.html') check = check | 2 else: self.fail('Wrong Verification Method: %s' % method.type) self.assertTrue(check == 2 ** 2 - 1, 'Should only have two Verification Methods, metatag and htmlpage')