-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix (CRB): hotfix 3.16.13 rights check on crb (#299)
- Loading branch information
Showing
3 changed files
with
18 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,10 @@ | |
from pathlib import Path | ||
from unittest import mock | ||
|
||
from django.http import Http404 | ||
|
||
from admin_cohort.models import User | ||
from cohort.crb.cohort_requests.abstract_cohort_request import is_cohort_request_pseudo_read | ||
from cohort.crb.enums import ResourceType | ||
from cohort.crb.exceptions import FhirException | ||
from cohort.crb.query_formatter import QueryFormatter | ||
|
@@ -88,3 +92,15 @@ def test_format_to_fhir_complex_query(self, query_fhir): | |
self.assertEquals(ResourceType.PATIENT, res_criteria.resource_type) | ||
self.assertEquals(self.fq_value_string, res_criteria.filter_solr, ) | ||
self.assertEquals("patient-active=true&codeList=A00-B99", res_criteria.filter_fhir) | ||
|
||
@mock.patch("cohort.crb.cohort_requests.abstract_cohort_request.get_user_from_token") | ||
def test_cohort_request_pseudo_read(self, mock_get_user_from_token): | ||
mock_get_user_from_token.return_value = User.objects.create(firstname='Test', | ||
lastname='USER', | ||
email='[email protected]', | ||
provider_username='1111111') | ||
auth_headers = {"Authorization": "Bearer XXX", | ||
"authorizationMethod": "OIDC"} | ||
with self.assertRaises(Http404): | ||
is_cohort_request_pseudo_read(auth_headers=auth_headers, source_population=[]) | ||
mock_get_user_from_token.assert_called() |