-
Notifications
You must be signed in to change notification settings - Fork 10
DATAUP-748 use locale en_US & other cleanup #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,4 +48,8 @@ dmypy.json | |
|
|
||
| # docker bits | ||
| Dockerfile* | ||
| docker-compose* | ||
| docker-compose* | ||
|
|
||
| # Temp files | ||
| tmp/ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,8 +13,7 @@ shell: | |
| docker-compose run re_api sh | ||
|
|
||
| reset: | ||
| docker-compose --rmi all -v | ||
| docker-compose build | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Forgot "down", and the "build" is redundant since the other make targets do it |
||
| docker-compose down --rmi all -v | ||
|
|
||
| full_query_testing: | ||
| DO_QUERY_TESTING=full time python -m pytest -s $(QUERY_TESTING_FILE) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| import os | ||
| from uuid import uuid4 | ||
|
|
||
| from relation_engine_client import REClient | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was confusing since |
||
| from relation_engine_client.main import REClient | ||
| from relation_engine_client.exceptions import RERequestError, RENotFound | ||
|
|
||
| _API_URL = os.environ.get("RE_API_URL", "http://localhost:5000") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -159,7 +159,7 @@ def resolve_remote(self, uri): | |
|
|
||
| if scheme in self.handlers: | ||
| result = self.handlers[scheme](uri) | ||
| elif scheme in [u"http", u"https"]: | ||
| elif scheme in ["http", "https"]: | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Autoformatters |
||
| # Requests has support for detecting the correct encoding of | ||
| # json over http | ||
| result = requests.get(uri).json() | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,9 @@ | ||
| """ | ||
| Tests for stored queries involving a fulltext search: | ||
| * Generic fulltext_search (should be used with caution because it can be slow and timeout at 60s) | ||
| * Taxonomy taxonomy_search_species_strain | ||
| * Taxonomy taxonomy_search_species_strain_no_sort | ||
|
|
||
| The latter two are switched between depending on the length of the search text. | ||
| These stored query tests are all bundled in one test file because their original purpose is to do a species/strain | ||
| name search on the ncbi_taxon collection | ||
|
|
||
| These tests run within the re_api docker image, and require access to the ArangoDB, auth, and workspace images. | ||
| """ | ||
|
|
@@ -251,148 +248,6 @@ def test_prefix_hit(self): | |
| ) | ||
|
|
||
|
|
||
| class TestFulltextSearchStoredQuery(unittest.TestCase): | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed tests pertaining to now axed |
||
| @classmethod | ||
| def setUpClass(cls): | ||
| check_spec_test_env() | ||
| create_test_docs("ncbi_taxon", ncbi_taxa) | ||
|
|
||
| def test_ncbi_taxon_scinames(self): | ||
| """Happy path""" | ||
| for sciname in scinames_test_all: | ||
| _fulltext_search_query( | ||
| self, | ||
| coll="ncbi_taxon", | ||
| search_attrkey="scientific_name", | ||
| search_text=sciname, | ||
| ts=_NOW if sciname in scinames_test_latest else None, | ||
| filter_attr_expr=[ | ||
| {"rank": "species"}, | ||
| {"rank": "strain"}, | ||
| {"strain": True}, | ||
| ], | ||
| offset=None, | ||
| limit=LIMIT, | ||
| select="scientific_name", | ||
| # --- | ||
| expect_error=False, | ||
| expect_hit=True, | ||
| ) | ||
|
|
||
| def test_null_bind_params(self): | ||
| """Leave off parameters""" | ||
| for sciname in scinames_test_all: | ||
| _fulltext_search_query( | ||
| self, | ||
| coll="ncbi_taxon", | ||
| search_attrkey="scientific_name", | ||
| search_text=sciname, | ||
| ts=None, | ||
| filter_attr_expr=None, | ||
| offset=None, | ||
| limit=None, | ||
| select=None, | ||
| # --- | ||
| expect_error=False, | ||
| expect_hit=True, | ||
| ) | ||
|
|
||
| def test_fully_specified_bind_params(self): | ||
| """Specify all parameters""" | ||
| for sciname in scinames_test_all: | ||
| _fulltext_search_query( | ||
| self, | ||
| coll="ncbi_taxon", | ||
| search_attrkey="scientific_name", | ||
| search_text=sciname, | ||
| ts=_NOW if sciname in scinames_test_latest else None, | ||
| filter_attr_expr=[ | ||
| {"rank": "species"}, | ||
| {"rank": "strain"}, | ||
| {"strain": True}, | ||
| ], | ||
| offset=0, | ||
| limit=LIMIT, | ||
| select=["id", "scientific_name"], | ||
| # --- | ||
| expect_error=False, | ||
| expect_hit=True, | ||
| ) | ||
|
|
||
| def test_extra_params(self): | ||
| """Extra params not in spec/aql""" | ||
| _fulltext_search_query( | ||
| self, | ||
| coll="ncbi_taxon", | ||
| search_attrkey="scientific_name", | ||
| search_text="esch", | ||
| ts=None, | ||
| filter_attr_expr=[ | ||
| {"rank": "species"}, | ||
| {"rank": "strain"}, | ||
| {"strain": True}, | ||
| ], | ||
| offset=0, | ||
| limit=LIMIT, | ||
| select=["id", "scientific_name"], | ||
| extra_unused_param=42, | ||
| # --- | ||
| expect_error=("Additional properties are not allowed"), | ||
| ) | ||
|
|
||
| def test_validation_fail(self): | ||
| _fulltext_search_query( | ||
| self, | ||
| coll=[], | ||
| search_attrkey=42, | ||
| search_text={"hi": 1}, | ||
| ts=None, | ||
| filter_attr_expr=None, | ||
| offset=None, | ||
| limit=None, | ||
| select=None, | ||
| # --- | ||
| expect_error="[] is not of type 'string'", | ||
| ) | ||
|
|
||
| def test_aql_error(self): | ||
| for sciname in scinames_test_all: | ||
| _fulltext_search_query( | ||
| self, | ||
| coll="ncbi_taxon", | ||
| search_attrkey="fake_attrkey", | ||
| search_text=sciname, | ||
| ts=None, | ||
| filter_attr_expr=None, | ||
| offset=None, | ||
| limit=None, | ||
| select=None, | ||
| # --- | ||
| expect_error=True, | ||
| ) | ||
|
|
||
| def test_no_hit(self): | ||
| for sciname in scinames_test_all: | ||
| _fulltext_search_query( | ||
| self, | ||
| coll="ncbi_taxon", | ||
| search_attrkey="scientific_name", | ||
| search_text=sciname[::-1], | ||
| ts=None, | ||
| filter_attr_expr=None, | ||
| offset=None, | ||
| limit=None, | ||
| select=None, | ||
| # --- | ||
| expect_error=False, | ||
| expect_hit=False, | ||
| expected_hits=[], | ||
| ) | ||
|
|
||
|
|
||
| # --- Test helpers --- | ||
|
|
||
|
|
||
| def _switch_taxonomy_search_species_strain_queries(search_text): | ||
| return ( | ||
| "taxonomy_search_species_strain_no_sort" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are generated by the comprehensive query testing, or any output files can go here