Skip to content

Commit b87ec14

Browse files
committed
Fix tests
1 parent 6ecb4d7 commit b87ec14

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

apps/dot_ext/tests/demographic_scopes_test_cases.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"request_scopes": APPLICATION_SCOPES_FULL,
6969
# Result:
7070
"result_form_is_valid": True,
71-
"result_token_scopes_granted": APPLICATION_SCOPES_NON_DEMOGRAPHIC,
71+
"result_token_scopes_granted": APPLICATION_SCOPES_FULL,
7272
},
7373
"test 2: share_demographic_scopes = False": {
7474
# Request:

apps/dot_ext/tests/test_form_oauth2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def test_form(self):
3131
# Loop through test cases in dictionary.
3232
cases = FORM_OAUTH2_SCOPES_TEST_CASES
3333
for case in cases:
34+
print(case)
3435
# Setup request parameters for test case.
3536
request_bene_share_demographic_scopes = cases[case]["request_bene_share_demographic_scopes"]
3637
request_scopes = cases[case]["request_scopes"]

apps/dot_ext/views/authorization.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@ def form_valid(self, form):
178178
access_token_delete_cnt = 0
179179
refresh_token_delete_cnt = 0
180180

181+
# Did the beneficiary choose not to share demographic scopes, or the application does not require them?
182+
if share_demographic_scopes == "False" or (allow is True and application.require_demographic_scopes is False):
183+
(data_access_grant_delete_cnt,
184+
access_token_delete_cnt,
185+
refresh_token_delete_cnt) = remove_application_user_pair_tokens_data_access(application, self.request.user)
186+
181187
if not scopes:
182188
return self.error_response("No scopes", application)
183189
try:
@@ -207,12 +213,6 @@ def form_valid(self, form):
207213
data_access_grant_delete_cnt=data_access_grant_delete_cnt)
208214
return response
209215

210-
# Did the beneficiary choose not to share demographic scopes, or the application does not require them?
211-
if share_demographic_scopes == "False" or (allow is True and application.require_demographic_scopes is False):
212-
(data_access_grant_delete_cnt,
213-
access_token_delete_cnt,
214-
refresh_token_delete_cnt) = remove_application_user_pair_tokens_data_access(application, self.request.user)
215-
216216
beneficiary_authorized_application.send(
217217
sender=self,
218218
request=self.request,

0 commit comments

Comments
 (0)