Skip to content

Commit

Permalink
Enabling tests that were pending on sodar-core v0.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe committed Apr 7, 2021
1 parent fbfff8c commit a59516e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
1 change: 0 additions & 1 deletion beaconsite/tests/test_permissions_ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def test_get(self, r_mock):


class TestBeaconQueryAjaxView(TestProjectAPIPermissionBase):
@skip(reason="missing urlescape in sodar_core, fixed in 0.9.1")
@requests_mock.Mocker()
def test_get(self, r_mock):
_local_site = SiteFactory(role=Site.LOCAL)
Expand Down
8 changes: 4 additions & 4 deletions clinvar_export/tests/test_permissions_ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,6 @@ def test_delete(self):
class TestQueryOmimAjaxViews(TestProjectAPIPermissionBase):
"""Permission tests for OMIM term AJAX views"""

@skip(reason="missing urlescape in sodar_core, fixed in 0.9.1")
def test(self):
hpo_record = HpoFactory()
url = (
Expand All @@ -649,16 +648,16 @@ def test(self):
self.delegate_as.user,
self.contributor_as.user,
self.guest_as.user,
self.user_no_roles,
]
bad_users = [self.anonymous, self.user_no_roles]
bad_users = [self.anonymous]
self.assert_response(url, good_users, 200, method="GET")
self.assert_response(url, bad_users, 302, method="GET") # redirect to login


class TestQueryHpoAjaxViews(TestProjectAPIPermissionBase):
"""Permission tests for the AJAX views for querying for HPO terms."""

@skip(reason="missing urlescape in sodar_core, fixed in 0.9.1")
def test(self):
hpo_record = HpoNameFactory()
url = (
Expand All @@ -672,8 +671,9 @@ def test(self):
self.delegate_as.user,
self.contributor_as.user,
self.guest_as.user,
self.user_no_roles,
]
bad_users = [self.anonymous, self.user_no_roles]
bad_users = [self.anonymous]
self.assert_response(url, good_users, 200, method="GET")
self.assert_response(url, bad_users, 302, method="GET") # redirect to login

Expand Down
9 changes: 5 additions & 4 deletions clinvar_export/tests/test_views_ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,13 +833,14 @@ def test_query(self):
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
res_json = response.json()
lst = [x.strip() for x in hpo_record.name.split(";") if x.strip()]
expected = jsonmatch.compile(
{
"query": hpo_record.database_id,
"result": [
{"term_id": "OMIM:0", "term_name": "Alternative Description"},
{"term_id": "OMIM:0", "term_name": "Disease 0"},
{"term_id": "OMIM:0", "term_name": "Gene Symbol"},
{"term_id": hpo_record.database_id, "term_name": lst[2]},
{"term_id": hpo_record.database_id, "term_name": lst[0]},
{"term_id": hpo_record.database_id, "term_name": lst[1]},
],
}
)
Expand All @@ -863,7 +864,7 @@ def test_query(self):
expected = jsonmatch.compile(
{
"query": hpo_name_record.hpo_id,
"result": [{"term_id": "HP:0000000", "term_name": "Phenotype 0"}],
"result": [{"term_id": hpo_name_record.hpo_id, "term_name": hpo_name_record.name}],
}
)
expected.assert_matches(res_json)
Expand Down

0 comments on commit a59516e

Please sign in to comment.