-
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.
test: add tests for search API session/client handling #258
- Loading branch information
1 parent
75bb983
commit b7dea73
Showing
2 changed files
with
67 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
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,21 @@ | ||
from datagateway_api.src.datagateway_api.icat.icat_client_pool import ICATClient | ||
from datagateway_api.src.search_api.session_handler import ( | ||
client_manager, | ||
SessionHandler, | ||
) | ||
|
||
|
||
class TestSessionHandler: | ||
def test_session_handler_class(self): | ||
assert isinstance(SessionHandler.client, ICATClient) | ||
|
||
def test_client_manager_decorator(self): | ||
@client_manager | ||
def manage_client(): | ||
pass | ||
|
||
# Checks that the decorator assigns a session ID, checking one is not present | ||
# before the decorator runs | ||
assert not SessionHandler.client.sessionId | ||
manage_client() | ||
assert SessionHandler.client.sessionId |