Skip to content

Commit

Permalink
Logic is wrong, everything must fail
Browse files Browse the repository at this point in the history
  • Loading branch information
brainstorm committed Feb 3, 2025
1 parent c3068aa commit bc0f049
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions ga4gh/htsget/compliance/file_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def identify_file(self, fp, source) -> (str, str):
file_payload, responses = methods.fetch_url(fp).json()
file_type = responses[0]["htsget"]["format"] # First response code is from htsget endpoint itself

# htsfile needs a file
with tempfile.NamedTemporaryFile(delete=True) as temp_file:
temp_file.write(file_payload.encode())
temp_file.flush()
Expand All @@ -74,6 +75,11 @@ def identify_file(self, fp, source) -> (str, str):
ext = c.EXTENSION_BCF
else:
ext = ".unknown_file_format"

# Append encryption file extension to file type if encrypted
if encryption_scheme is not None:
if encryption_scheme == c.ENCRYPTION_SCHEME_CRYPT4GH:
ext = ext + c.EXTENSION_C4GH

return (ext, encryption_scheme)

Expand All @@ -86,6 +92,10 @@ def validate(self):

if string_returned != string_expected:
result = FileValidator.FAILURE
if string_expected is None:
result = FileValidator.FAILURE
if string_returned is None:
result = FileValidator.FAILURE

return result

Expand Down
2 changes: 1 addition & 1 deletion ga4gh/htsget/compliance/test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def execute_test(self):
self.validate_response_code(responses)
# Validate the htsget response schema, not the payload of the individual URLs
self.validate_response_schema(htsget_response)
# FIXME: Consolidate fileparts logic with methods.fetch_url() since it aggregates as well, anyway
# Check against samtools (and crypt4gh) with local files fetched on the filesystem
self.validate_file_contents(htsget_response, params=params)
report_case.set_status_success()

Expand Down

0 comments on commit bc0f049

Please sign in to comment.