@@ -366,6 +366,62 @@ def test_publish_with_https():
366
366
_write_test_data (local_path )
367
367
368
368
res = f .publish_dataset (pub_test_metadata , title , authors , https_data_path = local_path , short_name = short_name )
369
+ assert res ['success' ]
370
+ assert res ['source_id' ] == f"_test_{ short_name } _v1.1"
371
+
372
+
373
+ @pytest .mark .skipif (bool (is_gha ), reason = "Not run as part of GHA CI" )
374
+ def test_publish_bad_links_with_https ():
375
+ """System test: Assess the end-to-end publication of a dataset via HTTPS
376
+ """
377
+
378
+ f = Foundry (index = "mdf-test" , authorizers = auths )
379
+ timestamp = datetime .now ().timestamp ()
380
+ title = "https_publish_test_{:.0f}" .format (timestamp )
381
+ short_name = "https_pub_{:.0f}" .format (timestamp )
382
+ authors = ["A Scourtas" ]
383
+ local_path = "./data/https_test"
384
+ links = {"horse" : "link" , "doi" : "3" , "url" : "www.test.com" , "description" : "string" , "bibtex" : "bib" }
385
+
386
+ # create test JSON to upload (if it doesn't already exist)
387
+ _write_test_data (local_path )
388
+
389
+ with pytest .raises (Exception ) as exc_info :
390
+ f .publish_dataset (pub_test_metadata ,
391
+ title ,
392
+ authors ,
393
+ https_data_path = local_path ,
394
+ short_name = short_name ,
395
+ links = links )
396
+ # err = exc_info.value
397
+ # assert hasattr(err, '__cause__')
398
+ # assert isinstance(err.__cause__, ValueError)
399
+ assert isinstance (exc_info .type (), ValueError )
400
+ _delete_test_data (f )
401
+
402
+
403
+ @pytest .mark .skipif (bool (is_gha ), reason = "Not run as part of GHA CI" )
404
+ def test_publish_links_with_https ():
405
+ """System test: Assess the end-to-end publication of a dataset via HTTPS
406
+ """
407
+
408
+ f = Foundry (index = "mdf-test" , authorizers = auths )
409
+ timestamp = datetime .now ().timestamp ()
410
+ title = "https_publish_test_{:.0f}" .format (timestamp )
411
+ short_name = "https_pub_{:.0f}" .format (timestamp )
412
+ authors = ["A Scourtas" ]
413
+ local_path = "./data/https_test"
414
+ links = {"type" : "link" , "doi" : "3" , "url" : "www.test.com" , "description" : "string" , "bibtex" : "bib" }
415
+
416
+ # create test JSON to upload (if it doesn't already exist)
417
+ _write_test_data (local_path )
418
+
419
+ res = f .publish_dataset (pub_test_metadata ,
420
+ title ,
421
+ authors ,
422
+ https_data_path = local_path ,
423
+ short_name = short_name ,
424
+ links = links )
369
425
370
426
assert res ['success' ]
371
427
assert res ['source_id' ] == f"_test_{ short_name } _v1.1"
0 commit comments