-
Notifications
You must be signed in to change notification settings - Fork 10
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 #306 from helxplatform/release-2.10.2
Release 2.10.2
- Loading branch information
Showing
7 changed files
with
872 additions
and
29 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
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,34 @@ | ||
"Integration tests for the async_search module" | ||
|
||
import asyncio | ||
from unittest import TestCase | ||
|
||
from fastapi.testclient import TestClient | ||
from elasticsearch.exceptions import ConnectionError | ||
class APISearchTestCase(TestCase): | ||
"API search with mocked elasticsearch" | ||
|
||
def test_concepts_types_parameter(self): | ||
"Test API concepts search with types parameter" | ||
# This should patch the elasticsearch object with the mock | ||
from dug.server import APP | ||
client = TestClient(APP) | ||
types = ['anatomical entity', 'drug'] | ||
body = { | ||
"index": "concepts_index", | ||
"query": "brain", | ||
"offset": 0, | ||
"size":20, | ||
"types": types | ||
} | ||
try: | ||
response = client.post("/search", json=body) | ||
except ConnectionError: | ||
self.fail("For the integration test, a populated elasticsearch " | ||
"instance must be available and configured in the " | ||
"environment variables. See dug.config for more.") | ||
self.assertEqual(response.status_code, 200) | ||
response_obj = response.json() | ||
response_types = set(hit['_source']['type'] for hit in | ||
response_obj['result']['hits']['hits']) | ||
self.assertEqual(response_types, set(types)) |
Oops, something went wrong.