@@ -446,27 +446,65 @@ def setup_method(self, test_targets):
446446 self .good_h5ad_test = tests .H5adHtanValidatorTest (self .good_h5ad_target )
447447 self .bad_h5ad_target = test_targets ["htan_bad_h5ad" ]
448448 self .bad_h5ad_test = tests .H5adHtanValidatorTest (self .bad_h5ad_target )
449+ self .txt_target = test_targets ["good_txt" ]
450+ self .txt_test = tests .H5adHtanValidatorTest (self .txt_target )
449451
450452 def test_that_the_command_is_produced (self ):
451453 process = self .good_h5ad_test .generate_process ()
452454 assert "/usr/local/bin/h5ad.py" in process .command
453455
454456 @docker_enabled_test
455- def test_that_the_exit_code_is_0_when_it_should_be (self ):
457+ def test_that_the_exit_code_is_1_when_it_should_be (self ):
456458 process = self .bad_h5ad_test .generate_process ()
457459 executor = DockerExecutor (
458460 process .container , process .command , self .bad_h5ad_target .file .url
459461 )
460462 executor .execute ()
461- assert executor .exit_code == "0"
463+ assert executor .std_out == (
464+ "HTAN h5ad File Validator\n "
465+ "File: htan_bad.h5ad\n "
466+ "Running cellxgene-schema\n "
467+ "Cellxgene run has errors. Please note errors or warnings in the output file.\n "
468+ "Running HTAN-specific validation\n "
469+ "HTAN Validation Failed.\n "
470+ "Please check output file for errors.\n "
471+ "\n "
472+ )
473+ assert executor .exit_code == "1"
462474
463475 @docker_enabled_test
464- def test_that_the_exit_code_is_1_when_it_should_be (self ):
476+ def test_that_the_exit_code_is_0_when_it_should_be (self ):
465477 process = self .good_h5ad_test .generate_process ()
466478 executor = DockerExecutor (
467479 process .container , process .command , self .good_h5ad_target .file .url
468480 )
469481 executor .execute ()
482+ assert executor .std_out == (
483+ "HTAN h5ad File Validator\n "
484+ "File: htan_good.h5ad\n "
485+ "Running cellxgene-schema\n "
486+ "Cellxgene run successful. Please check the output file to see if warnings exist.\n "
487+ "Running HTAN-specific validation\n "
488+ "Validation Passed!\n "
489+ "\n "
490+ )
491+ assert executor .exit_code == "0"
492+
493+ @docker_enabled_test
494+ def test_that_wrong_file_type_has_1_exit_code (self ):
495+ process = self .txt_test .generate_process ()
496+ executor = DockerExecutor (
497+ process .container , process .command , self .txt_target .file .url
498+ )
499+ executor .execute ()
500+ print (executor .std_out )
501+ assert executor .std_out == (
502+ "HTAN h5ad File Validator\n "
503+ "File: test.txt\n "
504+ "An error occurred while trying to open test.txt\n "
505+ "Unable to synchronously open file (file signature not found)\n "
506+ "\n "
507+ )
470508 assert executor .exit_code == "1"
471509
472510 def test_that_the_test_correctly_interprets_exit_code_0_and_1 (
0 commit comments