File: test_revoke_token.py

package info (click to toggle)
auth0-python 4.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,280 kB
  • sloc: python: 8,933; makefile: 15; sh: 2
file content (29 lines) | stat: -rw-r--r-- 936 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import unittest
from unittest import mock

from ...authentication.revoke_token import RevokeToken


class TestRevokeToken(unittest.TestCase):
    @mock.patch("auth0.rest.RestClient.post")
    def test_revoke_refresh_token(self, mock_post):
        a = RevokeToken("my.domain.com", "cid")

        # regular apps
        a.revoke_refresh_token(token="tkn")

        args, kwargs = mock_post.call_args

        self.assertEqual(args[0], "https://my.domain.com/oauth/revoke")
        self.assertEqual(kwargs["data"], {"client_id": "cid", "token": "tkn"})

        # confidential apps
        a = RevokeToken("my.domain.com", "cid", client_secret="sh!")
        a.revoke_refresh_token(token="tkn")

        args, kwargs = mock_post.call_args

        self.assertEqual(args[0], "https://my.domain.com/oauth/revoke")
        self.assertEqual(
            kwargs["data"], {"client_id": "cid", "token": "tkn", "client_secret": "sh!"}
        )