Skip to content

Commit

Permalink
fix: [RP] differentiate refresh token tests CIE/SPID
Browse files Browse the repository at this point in the history
  • Loading branch information
rglauco committed Jul 25, 2023
1 parent aca8c73 commit b59219d
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions spid_cie_oidc/provider/tests/test_03_refresh_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def setUp(self):
expires=timezone.localtime()
)

def test_grant_refresh_token(self):
@override_settings(OIDCFED_PROVIDER_MAX_CONSENT_TIMEFRAME=1, OIDCFED_DEFAULT_PROVIDER_PROFILE="cie")
def test_grant_refresh_token_cie(self):
client = Client()
url = reverse("oidc_provider_token_endpoint")
request = dict(
Expand All @@ -125,8 +126,8 @@ def test_grant_refresh_token(self):
self.assertEqual(refresh_token["aud"], RP_CLIENT_ID)
self.assertEqual(refresh_token["iss"], self.op_local_conf["sub"])

@override_settings(OIDCFED_PROVIDER_MAX_CONSENT_TIMEFRAME=1)
def test_grant_refresh_token_two_times(self):
@override_settings(OIDCFED_PROVIDER_MAX_CONSENT_TIMEFRAME=1, OIDCFED_PROVIDER_PROFILE="cie")
def test_grant_refresh_token_two_times_cie(self):
client = Client()
url = reverse("oidc_provider_token_endpoint")
request = dict(
Expand All @@ -148,3 +149,26 @@ def test_grant_refresh_token_two_times(self):
time.sleep(1)
res = client.post(url, request)
self.assertTrue(res.status_code == 400)

# @override_settings(OIDCFED_PROVIDER_MAX_REFRESH=1, OIDCFED_PROVIDER_PROFILE="spid")
# def test_grant_refresh_token_two_times_spid(self):
# client = Client()
# url = reverse("oidc_provider_token_endpoint")
# request = dict(
# client_id=RP_CLIENT_ID,
# client_assertion=self.ca_jws,
# client_assertion_type="urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
# refresh_token=self.rt_jws,
# grant_type="refresh_token"
# )
# res = client.post(url, request)
# self.assertTrue(res.status_code == 200)
# request = dict(
# client_id=RP_CLIENT_ID,
# client_assertion=self.ca_jws,
# client_assertion_type="urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
# refresh_token=res.json()["refresh_token"],
# grant_type="refresh_token"
# )
# res = client.post(url, request)
# self.assertTrue(res.status_code == 400)

0 comments on commit b59219d

Please sign in to comment.