-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OKTA-641384: clear token from cache on call to oauth.clear_access_tok…
…en() (#380) fix oauth.clear_access_token() update changelog and version --------- Co-authored-by: haggrip <[email protected]>
- Loading branch information
1 parent
700c5f1
commit d896f65
Showing
4 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '2.9.4' | ||
__version__ = '2.9.5' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from okta.oauth import OAuth | ||
|
||
""" | ||
Testing OAuth.clear_access_token | ||
""" | ||
class WasCalled: | ||
def __init__(self): | ||
self.value = False | ||
|
||
cache_delete_was_called = WasCalled | ||
headers_pop_was_called = WasCalled | ||
|
||
class mockCache: | ||
def delete(token): | ||
cache_delete_was_called.value = True | ||
|
||
class mockHeaders: | ||
def pop(header, ignored): | ||
headers_pop_was_called.value = True | ||
|
||
class mockRequestExecutor: | ||
def __init__(self, cache): | ||
self._cache = cache | ||
self._default_headers = mockHeaders | ||
|
||
def test_oauth_clear_access_token(): | ||
_mockRequestExecutor = mockRequestExecutor(mockCache) | ||
oauth = OAuth(_mockRequestExecutor, {}) | ||
oauth.clear_access_token() | ||
assert cache_delete_was_called.value | ||
assert headers_pop_was_called.value | ||
|