Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosribas committed Jul 18, 2024
1 parent 12885c2 commit 88e4226
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_fetch_data_with_fasta(mock_fetch_data):
api = ("https://wwwdev.ebi.ac.uk/ebisearch/ws/rest/rnacentral?"
"query=(TAXONOMY:559292)&size=1&sort=id&format=json")
response = client.post(
"/fetch-data/",
"/submit/",
json={"api_url": api, "data_type": "fasta"}
)
assert response.status_code == 200
Expand All @@ -39,7 +39,7 @@ def test_fetch_data_with_txt(mock_fetch_data):
api = ("https://wwwdev.ebi.ac.uk/ebisearch/ws/rest/rnacentral?"
"query=(TAXONOMY:559292)&size=1&sort=id&format=json")
response = client.post(
"/fetch-data/",
"/submit/",
json={"api_url": api, "data_type": "txt"}
)
assert response.status_code == 200
Expand All @@ -53,7 +53,7 @@ def test_fetch_data_with_json(mock_fetch_data):
api = ("https://wwwdev.ebi.ac.uk/ebisearch/ws/rest/rnacentral?"
"query=(TAXONOMY:559292)&size=1&sort=id&format=json")
response = client.post(
"/fetch-data/",
"/submit/",
json={"api_url": api, "data_type": "json"}
)
assert response.status_code == 200
Expand All @@ -67,15 +67,15 @@ def test_fetch_data_with_invalid_data_type(mock_fetch_data):
api = ("https://wwwdev.ebi.ac.uk/ebisearch/ws/rest/rnacentral?"
"query=(TAXONOMY:559292)&size=1&sort=id&format=json")
response = client.post(
"/fetch-data/",
"/submit/",
json={"api_url": api, "data_type": "invalid"}
)
assert response.status_code == 422


def test_fetch_data_with_empty_url(mock_fetch_data):
response = client.post(
"/fetch-data/",
"/submit/",
json={"api_url": "", "data_type": "json"}
)
assert response.status_code == 422
Expand Down Expand Up @@ -151,6 +151,7 @@ def test_download_file_processing(mocker):
def test_download_file_progress(mocker):
mock_result = Mock(state="RUNNING")
mock_result.info = {
"query": "",
"hit_count": 200,
"progress_ids": 50,
"progress_db_data": 0
Expand All @@ -165,6 +166,7 @@ def test_download_file_progress(mocker):
assert response.json() == {
"task_id": "mock-task-id",
"state": "RUNNING",
"query": "",
"hit_count": 200,
"progress_ids": 50,
"progress_db_data": 0
Expand Down

0 comments on commit 88e4226

Please sign in to comment.