Skip to content

Commit

Permalink
Merge pull request #121 from c3g/fix-literal-search
Browse files Browse the repository at this point in the history
Fix issues with "true" queries which should return all phenopackets
  • Loading branch information
davidlougheed committed May 15, 2020
2 parents 61dc5f8 + 7d2a5ba commit d4f9049
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ python:
- "3.6"
- "3.8"
addons:
postgresql: "11"
postgresql: "12"
apt:
packages:
- postgresql-11
- postgresql-contrib-11
- postgresql-12
- postgresql-contrib-12
before_install:
- sudo -u postgres psql -U postgres -p 5432 -d postgres -c "alter user postgres with password 'hj38f3Ntr';"
- sudo -u postgres psql -U postgres -p 5433 -d postgres -c "alter user postgres with password 'hj38f3Ntr';"
install:
- pip install -r requirements.txt
- pip install .
script:
- export POSTGRES_USER="postgres" && export POSTGRES_PASSWORD="hj38f3Ntr" && export POSTGRES_PORT=5432
- export POSTGRES_USER="postgres" && export POSTGRES_PASSWORD="hj38f3Ntr" && export POSTGRES_PORT=5433
- python3 -m coverage run ./manage.py test
- codecov
- rm -rf chord_metadata_service
Expand Down
10 changes: 10 additions & 0 deletions chord_metadata_service/chord/tests/test_api_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,16 @@ def test_private_table_search_4(self):
self.assertEqual(len(c["results"]), 1)
self.assertEqual(self.phenopacket.id, c["results"][0]["id"])

def test_private_table_search_5(self):
# Valid query: literal "true"
r = self.client.post(reverse("private-table-search", args=[str(self.dataset.identifier)]), data=json.dumps({
"query": True
}), content_type="application/json")
self.assertEqual(r.status_code, status.HTTP_200_OK)
c = r.json()
self.assertEqual(len(c["results"]), 1)
self.assertEqual(self.phenopacket.id, c["results"][0]["id"])

@patch('chord_metadata_service.chord.views_search.es')
def test_fhir_search(self, mocked_es):
mocked_es.search.return_value = SEARCH_SUCCESS
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ attrs==19.3.0
Babel==2.8.0
certifi==2020.4.5.1
chardet==3.0.4
chord-lib==0.8.0
chord_lib==0.9.0
codecov==2.0.22
colorama==0.4.3
coreapi==2.3.3
Expand Down Expand Up @@ -40,7 +40,7 @@ pytz==2020.1
PyYAML==5.3.1
rdflib==4.2.2
rdflib-jsonld==0.4.0
redis==3.4.1
redis==3.5.1
requests==2.23.0
rfc3987==1.3.8
simplejson==3.17.0
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

python_requires=">=3.6",
install_requires=[
"chord_lib[django]==0.8.0",
"Django>=2.2,<3.0",
"chord_lib[django]==0.9.0",
"Django>=2.2.12,<3.0",
"django-filter>=2.2,<3.0",
"django-nose>=1.4,<2.0",
"djangorestframework>=3.11,<3.12",
Expand Down

0 comments on commit d4f9049

Please sign in to comment.