-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #251 from ral-facilities/increase-test-coverage
Increase Test Coverage
- Loading branch information
Showing
6 changed files
with
97 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from icat.client import Client | ||
|
||
from datagateway_api.common.icat.icat_client_pool import ICATClient | ||
|
||
|
||
class TestICATClient: | ||
def test_init(self): | ||
test_icat_client = ICATClient() | ||
assert isinstance(test_icat_client, Client) | ||
|
||
assert not test_icat_client.autoLogout | ||
|
||
def test_clean_up(self): | ||
test_icat_client = ICATClient() | ||
assert id(test_icat_client) in Client.Register | ||
test_icat_client.clean_up() | ||
assert id(test_icat_client) not in Client.Register |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from datetime import date, datetime | ||
|
||
import pytest | ||
|
||
from datagateway_api.src.resources.entities.entity_map import type_conversion | ||
|
||
|
||
class TestOpenAPI: | ||
@pytest.mark.parametrize( | ||
"python_type, expected_type", | ||
[ | ||
pytest.param(int, {"type": "integer"}, id="integer"), | ||
pytest.param(float, {"type": "number", "format": "float"}, id="float"), | ||
pytest.param(bool, {"type": "boolean"}, id="boolean"), | ||
pytest.param( | ||
datetime, {"type": "string", "format": "datetime"}, id="datetime", | ||
), | ||
pytest.param(date, {"type": "string", "format": "date"}, id="date"), | ||
pytest.param(str, {"type": "string"}, id="string"), | ||
], | ||
) | ||
def test_type_conversion(self, python_type, expected_type): | ||
openapi_type = type_conversion(python_type) | ||
assert openapi_type == expected_type |
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