Skip to content

Commit

Permalink
create two separate tests for download_and_extract_antismash_data for…
Browse files Browse the repository at this point in the history
… non existing and broken ids
  • Loading branch information
gcroci2 committed Jul 12, 2023
1 parent bcc196c commit 6bdff4c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/genomics/antismash/test_antismash_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,20 @@ def test_error_nonempty_path(self, tmp_path):
tmp_path / "extracted")
assert "Nonempty directory" in e.value.args[0]

def test_broken_url(self, tmp_path):
broken_antismash_id = 'broken_id'
def test_nonexisting_id(self, tmp_path):
nonexisting_antismash_id = 'nonexisting_id'
download_root = tmp_path / "download"
download_root.mkdir()
extract_root = tmp_path / "extracted"
extract_root.mkdir()
with pytest.raises(urllib.error.HTTPError):
download_and_extract_antismash_data(nonexisting_antismash_id, download_root,
extract_root)
extracted_folder = extract_root / "antismash" / nonexisting_antismash_id
assert not extracted_folder.exists()

def test_broken_id(self, tmp_path):
broken_antismash_id = 'GCF_000702345.1'
download_root = tmp_path / "download"
download_root.mkdir()
extract_root = tmp_path / "extracted"
Expand Down

0 comments on commit 6bdff4c

Please sign in to comment.