Skip to content

Commit 26dff2a

Browse files
authored
Update jwt refresh duration default param fix (#492)
* fix update jwt optional param default value add test * update test * set default zero
1 parent e56d018 commit 26dff2a

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

descope/management/jwt.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
class JWT(AuthBase):
1515
def update_jwt(
16-
self, jwt: str, custom_claims: dict, refresh_duration: Optional[int]
16+
self, jwt: str, custom_claims: dict, refresh_duration: int = 0
1717
) -> str:
1818
"""
1919
Given a valid JWT, update it with custom claims, and update its authz claims as well

tests/management/test_jwt.py

+20
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,26 @@ def test_update_jwt(self):
6969
timeout=DEFAULT_TIMEOUT_SECONDS,
7070
)
7171

72+
resp = client.mgmt.jwt.update_jwt("test", {"k1": "v1"})
73+
self.assertEqual(resp, "response")
74+
expected_uri = f"{common.DEFAULT_BASE_URL}{MgmtV1.update_jwt_path}"
75+
mock_post.assert_called_with(
76+
expected_uri,
77+
headers={
78+
**common.default_headers,
79+
"Authorization": f"Bearer {self.dummy_project_id}:{self.dummy_management_key}",
80+
},
81+
json={
82+
"jwt": "test",
83+
"customClaims": {"k1": "v1"},
84+
"refreshDuration": 0,
85+
},
86+
allow_redirects=False,
87+
verify=True,
88+
params=None,
89+
timeout=DEFAULT_TIMEOUT_SECONDS,
90+
)
91+
7292
def test_impersonate(self):
7393
client = DescopeClient(
7494
self.dummy_project_id,

0 commit comments

Comments
 (0)