@@ -43,7 +43,7 @@ def test_01_search_part_01(self):
43
43
# self.assertTrue(isinstance(search_result, list), f'search_result is not list: {search_result}')
44
44
self .assertEqual (len (item_collections .items ), 4000 , f'wrong length' )
45
45
search_result = set ([k .id for k in item_collections .items ])
46
- self .assertEqual (len (search_result ),4000 , f'wrong length. not unique' )
46
+ self .assertEqual (len (search_result ), 4000 , f'wrong length. not unique' )
47
47
self .assertTrue (FileUtils .file_exist (os .environ ['OUTPUT_FILE' ]), f'missing output file' )
48
48
self .assertEqual (sorted (json .dumps (FileUtils .read_json (os .environ ['OUTPUT_FILE' ]))), sorted (search_result_str ), f'not identical result' )
49
49
return
@@ -226,7 +226,8 @@ def test_02_download(self):
226
226
with tempfile .TemporaryDirectory () as tmp_dir_name :
227
227
os .environ ['OUTPUT_FILE' ] = os .path .join (tmp_dir_name , 'some_output' , 'output.json' )
228
228
os .environ ['DOWNLOAD_DIR' ] = tmp_dir_name
229
- download_result = choose_process ()
229
+ download_result_str = choose_process ()
230
+ download_result = json .loads (download_result_str )
230
231
self .assertTrue ('features' in download_result , f'missing features in download_result' )
231
232
self .assertEqual (len (download_result ['features' ]) + 2 , len (glob (os .path .join (tmp_dir_name , '*' ))), f'downloaded file does not match' )
232
233
error_file = os .path .join (tmp_dir_name , 'error.log' )
@@ -256,7 +257,8 @@ def test_02_download__daac(self):
256
257
with tempfile .TemporaryDirectory () as tmp_dir_name :
257
258
os .environ ['OUTPUT_FILE' ] = os .path .join (tmp_dir_name , 'some_output' , 'output.json' )
258
259
os .environ ['DOWNLOAD_DIR' ] = tmp_dir_name
259
- download_result = choose_process ()
260
+ download_result_str = choose_process ()
261
+ download_result = json .loads (download_result_str )
260
262
self .assertTrue ('features' in download_result , f'missing features in download_result' )
261
263
self .assertEqual (len (download_result ['features' ]) + 2 , len (glob (os .path .join (tmp_dir_name , '*' ))), f'downloaded file does not match' )
262
264
error_file = os .path .join (tmp_dir_name , 'error.log' )
@@ -291,7 +293,8 @@ def test_02_download__daac__from_file(self):
291
293
FileUtils .write_json (granule_json_file , granule_json )
292
294
os .environ ['STAC_JSON' ] = granule_json_file
293
295
os .environ ['DOWNLOAD_DIR' ] = downloading_dir
294
- download_result = choose_process ()
296
+ download_result_str = choose_process ()
297
+ download_result = json .loads (download_result_str )
295
298
self .assertTrue ('features' in download_result , f'missing features in download_result' )
296
299
self .assertEqual (len (download_result ['features' ]) + 1 , len (glob (os .path .join (downloading_dir , '*' ))), f'downloaded file does not match' )
297
300
error_file = os .path .join (downloading_dir , 'error.log' )
@@ -320,7 +323,8 @@ def test_02_download__daac_error(self): # TODO update this later
320
323
os .environ ['OUTPUT_FILE' ] = os .path .join (tmp_dir_name , 'some_output' , 'output.json' )
321
324
# TODO this is downloading a login page HTML
322
325
os .environ ['DOWNLOAD_DIR' ] = tmp_dir_name
323
- download_result = choose_process ()
326
+ download_result_str = choose_process ()
327
+ download_result = json .loads (download_result_str )
324
328
self .assertTrue (isinstance (download_result , list ), f'download_result is not list: { download_result } ' )
325
329
self .assertEqual (sum ([len (k ) for k in download_result ]), len (glob (os .path .join (tmp_dir_name , '*' ))), f'downloaded file does not match' )
326
330
error_file = os .path .join (tmp_dir_name , 'error.log' )
@@ -344,7 +348,8 @@ def test_02_download__from_file(self):
344
348
FileUtils .write_json (granule_json_file , granule_json )
345
349
os .environ ['STAC_JSON' ] = granule_json_file
346
350
os .environ ['DOWNLOAD_DIR' ] = downloading_dir
347
- download_result = choose_process ()
351
+ download_result_str = choose_process ()
352
+ download_result = json .loads (download_result_str )
348
353
self .assertTrue ('features' in download_result , f'missing features in download_result' )
349
354
self .assertEqual (len (download_result ['features' ]) + 1 , len (glob (os .path .join (downloading_dir , '*' ))), f'downloaded file does not match' )
350
355
error_file = os .path .join (downloading_dir , 'error.log' )
@@ -373,7 +378,8 @@ def test_02_download__from_http(self):
373
378
FileUtils .write_json (granule_json_file , granule_json )
374
379
os .environ ['STAC_JSON' ] = granule_json_file
375
380
os .environ ['DOWNLOAD_DIR' ] = downloading_dir
376
- download_result = choose_process ()
381
+ download_result_str = choose_process ()
382
+ download_result = json .loads (download_result_str )
377
383
self .assertTrue ('features' in download_result , f'missing features in download_result' )
378
384
self .assertEqual (len (download_result ['features' ]) + 1 , len (glob (os .path .join (downloading_dir , '*' ))), f'downloaded file does not match' )
379
385
error_file = os .path .join (tmp_dir_name , 'error.log' )
@@ -836,7 +842,8 @@ def test_03_upload_complete_catalog(self):
836
842
with open (os .environ ['CATALOG_FILE' ], 'w' ) as ff :
837
843
ff .write (json .dumps (catalog .to_dict (False , False )))
838
844
839
- upload_result = choose_process ()
845
+ upload_result_str = choose_process ()
846
+ upload_result = json .loads (upload_result_str )
840
847
print (upload_result )
841
848
self .assertTrue ('features' in upload_result , 'missing features' )
842
849
self .assertEqual (1 , len (upload_result ['features' ]), 'wrong length of upload_result features' )
@@ -892,7 +899,8 @@ def test_04_catalog(self):
892
899
argv .append ('CATALOG' )
893
900
with tempfile .TemporaryDirectory () as tmp_dir_name :
894
901
os .environ ['OUTPUT_FILE' ] = os .path .join (tmp_dir_name , 'some_output' , 'output.json' )
895
- catalog_result = choose_process ()
902
+ catalog_result_str = choose_process ()
903
+ catalog_result = json .loads (catalog_result_str )
896
904
self .assertEqual ('registered' , catalog_result , 'wrong status' )
897
905
self .assertTrue (FileUtils .file_exist (os .environ ['OUTPUT_FILE' ]), f'missing output file' )
898
906
return
@@ -916,7 +924,8 @@ def test_04_catalog_from_file(self):
916
924
FileUtils .write_json (input_file_path , upload_result )
917
925
os .environ ['UPLOADED_FILES_JSON' ] = input_file_path
918
926
os .environ ['OUTPUT_FILE' ] = os .path .join (tmp_dir_name , 'some_output' , 'output.json' )
919
- catalog_result = choose_process ()
927
+ catalog_result_str = choose_process ()
928
+ catalog_result = json .loads (catalog_result_str )
920
929
self .assertEqual ('registered' , catalog_result , 'wrong status' )
921
930
self .assertTrue (FileUtils .file_exist (os .environ ['OUTPUT_FILE' ]), f'missing output file' )
922
931
return
@@ -940,7 +949,8 @@ def test_04_catalog_from_file_item_collection(self):
940
949
FileUtils .write_json (input_file_path , upload_result )
941
950
os .environ ['UPLOADED_FILES_JSON' ] = input_file_path
942
951
os .environ ['OUTPUT_FILE' ] = os .path .join (tmp_dir_name , 'some_output' , 'output.json' )
943
- catalog_result = choose_process ()
952
+ catalog_result_str = choose_process ()
953
+ catalog_result = json .loads (catalog_result_str )
944
954
self .assertEqual ('registered' , catalog_result , 'wrong status' )
945
955
self .assertTrue (FileUtils .file_exist (os .environ ['OUTPUT_FILE' ]), f'missing output file' )
946
956
return
0 commit comments