Skip to content

Commit 1287195

Browse files
committed
intermediary commit
1 parent 80e796a commit 1287195

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

apps/dot_ext/tests/test_authorization.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
from django.urls import reverse
1313
from django.test import Client
1414
from waffle.testutils import override_switch
15+
from apps.fhir.bluebutton.models import Crosswalk
16+
from django.contrib.auth.models import User
17+
from waffle import switch_is_active
1518

1619
from apps.test import BaseApiTest
1720
from ..models import Application, ArchivedToken
@@ -271,7 +274,10 @@ def test_refresh_token(self):
271274
'client_secret': application.client_secret_plain,
272275
}
273276
c = Client()
274-
response = c.post('/v1/o/token/', data=token_request_data)
277+
if switch_is_active('v3_endpoints'):
278+
response = c.post('/v3/o/token/', data=token_request_data)
279+
else:
280+
response = c.post('/v2/o/token/', data=token_request_data)
275281
self.assertEqual(response.status_code, 200)
276282
# Now we have a token and refresh token
277283
tkn = response.json()['access_token']
@@ -286,6 +292,14 @@ def test_refresh_token(self):
286292
response = self.client.post(reverse('oauth2_provider:token'), data=refresh_request_data)
287293
self.assertEqual(response.status_code, 200)
288294
self.assertNotEqual(response.json()['access_token'], tkn)
295+
user = User.objects.get(username='anna')
296+
crosswalk = Crosswalk.objects.get(user=user)
297+
print(f'what is in crosswalk {crosswalk.fhir_id_v3}')
298+
# Verify both fhir_id_v2 and fhir_id_v3 are populated
299+
self.assertIsNotNone(crosswalk.fhir_id_v2)
300+
self.assertIsNotNone(crosswalk.fhir_id_v3)
301+
self.assertTrue(len(crosswalk.fhir_id_v2) > 0)
302+
self.assertTrue(len(crosswalk.fhir_id_v3) > 0)
289303

290304
def test_refresh_with_expired_token(self):
291305
redirect_uri = 'http://localhost'

0 commit comments

Comments
 (0)