-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
539 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import pytest | ||
from aioresponses import aioresponses | ||
|
||
from src.api.dotty import DottyClient | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_to_spdi_success(): | ||
"""Test to_spdi method with a successful response.""" | ||
with aioresponses() as m: | ||
mock_response = {"success": True, "value": "mocked response data"} | ||
m.get( | ||
"https://example.com/dotty/api/v1/to-spdi?q=test_query&assembly=GRCh38", | ||
payload=mock_response, | ||
status=200, | ||
) | ||
|
||
client = DottyClient(api_base_url="https://example.com/dotty") | ||
response = await client.to_spdi("test_query", "GRCh38") | ||
|
||
assert response == mock_response | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_to_spdi_failure(): | ||
"""Test to_spdi method with a failed response.""" | ||
with aioresponses() as m: | ||
m.get("https://example.com/dotty/api/v1/to-spdi?q=test_query&assembly=GRCh38", status=404) | ||
|
||
client = DottyClient(api_base_url="https://example.com/dotty") | ||
response = await client.to_spdi("test_query", "GRCh38") | ||
|
||
assert response is None | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_to_spdi_grch37_assembly(): | ||
"""Test to_spdi method with default assembly.""" | ||
with aioresponses() as m: | ||
mock_response = {"success": True, "value": "mocked response data"} | ||
m.get( | ||
"https://example.com/dotty/api/v1/to-spdi?q=test_query&assembly=GRCh37", | ||
payload=mock_response, | ||
status=200, | ||
) | ||
|
||
client = DottyClient(api_base_url="https://example.com/dotty") | ||
response = await client.to_spdi("test_query", "GRCh37") | ||
|
||
assert response == mock_response |
Empty file.
Empty file.
Empty file.