def test_api_get_download_urls(self): entity_ids = inventory.convert(self.token, ['LC08_L1TP_156063_20170207_20170216_01_T1'], 'LANDSAT_8_C1') results = inventory.get_download_urls(self.token, ['LC08_L1TP_156063_20170207_20170216_01_T1'], 'LANDSAT_8_C1') self.assertIsInstance(results, dict) ehost, ihost = 'invalid.com', '127.0.0.1' results = {k:v.replace(ehost, ihost) for k,v in results.items()} self.assertEqual(set(entity_ids.values()), set(['LC81560632017038LGN00'])) ip_address_host_regex = 'http://\d+\.\d+\.\d+\.\d+/.*\.tar\.gz' for pid in entity_ids.values(): self.assertRegexpMatches(results.get(pid), ip_address_host_regex)
def test_api_get_download_urls(self): entity_ids = inventory.convert(self.token, self.contact_id, self.collection_ids) results = inventory.get_download_urls(self.token, self.contact_id, self.collection_ids, self.usage) self.assertIsInstance(results, dict) ehost, ihost = 'invalid.com', '127.0.0.1' results = {k: v.replace(ehost, ihost) for k, v in results.items()} self.assertEqual(set(entity_ids.values()), set(results)) ip_address_host_regex = 'http://\d+\.\d+\.\d+\.\d+/.*\.tar\.gz' for pid in entity_ids.values(): self.assertRegexpMatches(results.get(pid), ip_address_host_regex)
def test_api_id_lookup(self): entity_ids = inventory.convert(self.token, ['LC08_L1TP_156063_20170207_20170216_01_T1'], 'LANDSAT_8_C1') self.assertEqual(set(['LC08_L1TP_156063_20170207_20170216_01_T1']), set(entity_ids))
def test_bad_id_lookup(self): with self.assertRaisesRegexp(inventory.LTAError, 'ID Lookup failed'): _ = inventory.convert(self.token, self.contact_id, ['LC08_L1TP_000000_19000101_00000000_00_T1'])
def test_id_sensor_limits(self): with self.assertRaisesRegexp(ProductNotImplemented, 'is not a supported sensor product'): _ = inventory.convert(self.token, self.contact_id, ['bad_id_yo'])
def test_api_id_lookup(self): entity_ids = inventory.convert(self.token, self.contact_id, self.collection_ids) self.assertEqual(set(self.collection_ids), set(entity_ids))