Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_init(self):
o = Ordering()
assert isinstance(o, Ordering)
def test_init(self):
o = Ordering()
assert isinstance(o, Ordering)
def test_order_batching(self):
o = Ordering()
res = o.location(['10400100120FEA00', '101001000DB2FB00'], batch_size=1)
acq_list = res['acquisitions']
assert len(acq_list) == 2
for entry in res['acquisitions']:
assert entry['location'].startswith('s3')
def test_get_order_status(self):
o = Ordering()
results = o.status('c5cd8157-3001-4a03-a716-4ef673748c7a')
print(results)
for result in results:
assert 'acquisition_id' in result.keys()
assert 'state' in result.keys()
assert 'location' in result.keys()
def test_order_batching(self):
o = Ordering()
order_id = o.order(['10400100120FEA00', '101001000DB2FB00'], batch_size=1)
# assert order_id == '2b3ba38e-4d7e-4ef6-ac9d-2e2e0a8ca1e7'
assert len(order_id) == 2
assert len(order_id[0]) == 36
def test_heartbeat_failure(self):
# mock requests.get so that we get a result for which response.json() will throw an exception
with patch('gbdxtools.ordering.requests.get', return_value = False) as mock_within:
o = Ordering()
assert o.heartbeat() == False
def __init__(self, **kwargs):
interface = Auth(**kwargs)
self.gbdx_connection = interface.gbdx_connection
self.root_url = interface.root_url
self.logger = interface.logger
# create and store an instance of the GBDX s3 client
self.s3 = S3()
# create and store an instance of the GBDX Ordering Client
self.ordering = Ordering()
# create and store an instance of the GBDX Catalog Client
self.catalog = Catalog()
# create and store an instance of the GBDX Workflow Client
self.workflow = Workflow()
# create and store an instance of the Idaho Client
self.idaho = Idaho()
self.vectors = Vectors()
self.catalog_image = CatalogImage
self.idaho_image = IdahoImage
self.landsat_image = LandsatImage
self.sentinel2 = Sentinel2
"""
try:
record = self.get(catalog_id)
except:
return None
# Handle Landsat8
if 'Landsat8' in record['type'] and 'LandsatAcquisition' in record['type']:
bucket = record['properties']['bucketName']
prefix = record['properties']['bucketPrefix']
return 's3://' + bucket + '/' + prefix
# Handle DG Acquisition
if 'DigitalGlobeAcquisition' in record['type']:
o = Ordering()
res = o.location([catalog_id])
return res['acquisitions'][0]['location']
return None
def __init__(self, **kwargs):
interface = Auth(**kwargs)
self.gbdx_connection = interface.gbdx_connection
self.root_url = interface.root_url
self.logger = interface.logger
# create and store an instance of the GBDX s3 client
self.s3 = S3()
# create and store an instance of the GBDX Ordering Client
self.ordering = Ordering()
# create and store an instance of the GBDX Catalog Client
self.catalog = Catalog()
# create and store an instance of the GBDX Workflow Client
self.workflow = Workflow()
# create and store an instance of the Idaho Client
self.idaho = Idaho()
self.vectors = Vectors()
self.catalog_image = CatalogImage
self.idaho_image = IdahoImage
self.landsat_image = LandsatImage
self.modis = Modis