def test_validate_osparc_file_name_more_then_one_extention(): with pytest.raises(ExporterException) as exc_info: validate_osparc_import_name("v1.osparc") assert exc_info.type is ExporterException assert (exc_info.value.args[0] == "Could not find a digest in provided file_name=v1.osparc")
def test_validate_osparc_file_name_no_extention(): with pytest.raises(ExporterException) as exc_info: validate_osparc_import_name( "v1#SHA256=80e69a0973e15f4a9c3c180d00a39ee0b0dfafe43356f867983e1180e9b5a892" ) assert exc_info.type is ExporterException assert exc_info.value.args[0] == ( "Provided file name must haave .osparc extension file_name=v1#SHA256=" "80e69a0973e15f4a9c3c180d00a39ee0b0dfafe43356f867983e1180e9b5a892")
def test_validate_osparc_file_name_too_many_shasums(): with pytest.raises(ExporterException) as exc_info: validate_osparc_import_name(( "v1#SHA256=80e69a0973e15f4a9c3c180d00a39ee0b0dfafe43356f867983e118" "0e9b5a892SHA256=80e69a0973e15f4a9c3c180d00a39ee0b0dfafe43356f867983e1180e9b5a892.osparc" )) assert exc_info.type is ExporterException assert exc_info.value.args[0] == ( "Could not find a valid digest in provided file_name=v1#SHA256=80e69a0973e15f" "4a9c3c180d00a39ee0b0dfafe43356f867983e1180e9b5a892SHA256=80e69a0973e15f4a9c3c" "180d00a39ee0b0dfafe43356f867983e1180e9b5a892.osparc")
def test_validate_osparc_file_name_ok(): algorithm, digest_sum = validate_osparc_import_name( "v1#SHA256=80e69a0973e15f4a9c3c180d00a39ee0b0dfafe43356f867983e1180e9b5a892.osparc" ) assert isinstance(algorithm, Algorithm) assert (digest_sum == "80e69a0973e15f4a9c3c180d00a39ee0b0dfafe43356f867983e1180e9b5a892")