-
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.
#217: Add tests for camelCase ICAT entity name function
- Loading branch information
1 parent
b9fc454
commit 285362a
Showing
1 changed file
with
34 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import pytest | ||
|
||
from datagateway_api.common.exceptions import BadRequestError | ||
from datagateway_api.common.icat.helpers import get_icat_entity_name_as_camel_case | ||
|
||
|
||
class TestICATHelpers: | ||
"""Testing the helper functions which aren't covered in the endpoint tests""" | ||
|
||
@pytest.mark.parametrize( | ||
"input_entity_name, expected_entity_name", | ||
[ | ||
pytest.param("User", "user", id="singular single word entity name"), | ||
pytest.param( | ||
"PublicStep", "publicStep", id="singular two word entity name", | ||
), | ||
pytest.param( | ||
"PermissibleStringValue", | ||
"permissibleStringValue", | ||
id="singular multi-word entity name", | ||
), | ||
], | ||
) | ||
def test_valid_get_icat_entity_name_as_camel_case( | ||
self, icat_client, input_entity_name, expected_entity_name, | ||
): | ||
camel_case_entity_name = get_icat_entity_name_as_camel_case( | ||
icat_client, input_entity_name, | ||
) | ||
assert camel_case_entity_name == expected_entity_name | ||
|
||
def test_invalid_get_icat_entity_name_as_camel_case(self, icat_client): | ||
with pytest.raises(BadRequestError): | ||
get_icat_entity_name_as_camel_case(icat_client, "UnknownEntityName") |