| 1 |
import unittest |
| 2 |
from unittest import mock |
| 3 |
|
| 4 |
from auth0.authentication.revoke_token import RevokeToken |
| 5 |
|
| 6 |
|
| 7 |
class TestRevokeToken(unittest.TestCase): |
| 8 |
@mock.patch("auth0.authentication.rest.RestClient.post") |
| 9 |
def test_revoke_refresh_token(self, mock_post): |
| 10 |
a = RevokeToken("my.domain.com", "cid") |
| 11 |
|
| 12 |
|
| 13 |
a.revoke_refresh_token(token="tkn") |
| 14 |
|
| 15 |
args, kwargs = mock_post.call_args |
| 16 |
|
| 17 |
self.assertEqual(args[0], "https://my.domain.com/oauth/revoke") |
| 18 |
self.assertEqual(kwargs["data"], {"client_id": "cid", "token": "tkn"}) |
| 19 |
|
| 20 |
|
| 21 |
a = RevokeToken("my.domain.com", "cid", client_secret="sh!") |
| 22 |
a.revoke_refresh_token(token="tkn") |
| 23 |
|
| 24 |
args, kwargs = mock_post.call_args |
| 25 |
|
| 26 |
self.assertEqual(args[0], "https://my.domain.com/oauth/revoke") |
| 27 |
self.assertEqual( |
| 28 |
kwargs["data"], {"client_id": "cid", "token": "tkn", "client_secret": "sh!"} |
| 29 |
) |