def test_check(self): checker = ManifestChecker(TEST_MANIFEST) ext_data = checker.check() self.assertEqual(len(ext_data), NUM_ALL_EXT_DATA) ext_data_with_new_version = 0 for data in ext_data: if data.new_version: ext_data_with_new_version += 1 self.assertEqual(ext_data_with_new_version, 1) file_ext_data = checker.get_external_data(ExternalData.Type.FILE) self.assertEqual(len(file_ext_data), NUM_FILE_IN_MANIFEST) archive_ext_data = checker.get_external_data(ExternalData.Type.ARCHIVE) self.assertEqual(len(archive_ext_data), NUM_ARCHIVE_IN_MANIFEST) extra_data = checker.get_external_data(ExternalData.Type.EXTRA_DATA) self.assertEqual(len(extra_data), NUM_EXTRA_DATA_IN_MANIFEST) outdated_ext_data = checker.get_outdated_external_data() self.assertEqual(len(outdated_ext_data), NUM_ALL_EXT_DATA - 1) dropbox = self._find_by_filename(ext_data, "dropbox.tgz") self.assertIsNotNone(dropbox) self.assertEqual(dropbox.new_version.version, "64") self.assertEqual(dropbox.new_version.url, "https://httpbingo.org/base64/4puE") # this URL is a redirect, but since it is not a rotating-url the URL # should not be updated. image = self._find_by_filename(ext_data, "image.jpeg") self.assertIsNone(image)
def test_check(self): checker = ManifestChecker(TEST_MANIFEST) ext_data = checker.check() self.assertEqual(len(ext_data), NUM_ALL_EXT_DATA) ext_data_with_new_version = 0 for data in ext_data: if data.new_version: ext_data_with_new_version += 1 self.assertEqual(ext_data_with_new_version, 2) file_ext_data = checker.get_external_data(ExternalData.Type.FILE) self.assertEqual(len(file_ext_data), NUM_FILE_IN_MANIFEST) archive_ext_data = checker.get_external_data(ExternalData.Type.ARCHIVE) self.assertEqual(len(archive_ext_data), NUM_ARCHIVE_IN_MANIFEST) extra_data = checker.get_external_data(ExternalData.Type.EXTRA_DATA) self.assertEqual(len(extra_data), NUM_EXTRA_DATA_IN_MANIFEST) outdated_ext_data = checker.get_outdated_external_data() self.assertEqual(len(outdated_ext_data), NUM_ALL_EXT_DATA - 1) dropbox = self._find_by_filename(ext_data, "dropbox.tgz") self.assertIsNotNone(dropbox) self.assertEqual(dropbox.new_version.version, "64") self.assertEqual(dropbox.new_version.url, "https://httpbingo.org/base64/4puE") relative_redirect = self._find_by_filename(ext_data, "relative-redirect.txt") self.assertIsNotNone(relative_redirect) self.assertEqual( relative_redirect.new_version.url, "https://httpbingo.org/base64/MzAtNTAgZmVyYWwgaG9ncyEK", ) self.assertEqual( relative_redirect.new_version.checksum, "e4d67702da4eeeb2f15629b65bf6767c028a511839c14ed44d9f34479eaa2b94", ) self.assertEqual(relative_redirect.new_version.size, 18) # this URL is a redirect, but since it is not a rotating-url the URL # should not be updated. image = self._find_by_filename(ext_data, "image.jpeg") self.assertIsNone(image)