File tree Expand file tree Collapse file tree 4 files changed +38
-1
lines changed Expand file tree Collapse file tree 4 files changed +38
-1
lines changed Original file line number Diff line number Diff line change 1
1
# Okta Python SDK Changelog
2
2
3
+ ## 2.9.5
4
+ * Clear access token from cache on call to OAuth.clear_access_token()
5
+
3
6
## 2.9.4
4
7
* Add optional parameter to api_response.next() to include response object as a third tuple value.
5
8
Original file line number Diff line number Diff line change 1
- __version__ = '2.9.4 '
1
+ __version__ = '2.9.5 '
Original file line number Diff line number Diff line change @@ -90,3 +90,5 @@ def clear_access_token(self):
90
90
Clear currently used OAuth access token, probably expired
91
91
"""
92
92
self ._access_token = None
93
+ self ._request_executor ._cache .delete ("OKTA_ACCESS_TOKEN" )
94
+ self ._request_executor ._default_headers .pop ("Authorization" , None )
Original file line number Diff line number Diff line change
1
+ from okta .oauth import OAuth
2
+
3
+ """
4
+ Testing OAuth.clear_access_token
5
+ """
6
+ class WasCalled :
7
+ def __init__ (self ):
8
+ self .value = False
9
+
10
+ cache_delete_was_called = WasCalled
11
+ headers_pop_was_called = WasCalled
12
+
13
+ class mockCache :
14
+ def delete (token ):
15
+ cache_delete_was_called .value = True
16
+
17
+ class mockHeaders :
18
+ def pop (header , ignored ):
19
+ headers_pop_was_called .value = True
20
+
21
+ class mockRequestExecutor :
22
+ def __init__ (self , cache ):
23
+ self ._cache = cache
24
+ self ._default_headers = mockHeaders
25
+
26
+ def test_oauth_clear_access_token ():
27
+ _mockRequestExecutor = mockRequestExecutor (mockCache )
28
+ oauth = OAuth (_mockRequestExecutor , {})
29
+ oauth .clear_access_token ()
30
+ assert cache_delete_was_called .value
31
+ assert headers_pop_was_called .value
32
+
You can’t perform that action at this time.
0 commit comments