File: base.py

package info (click to toggle)
python-duo-client 5.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 768 kB
  • sloc: python: 7,105; sh: 6; makefile: 4
file content (26 lines) | stat: -rw-r--r-- 760 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
import unittest
from unittest.mock import patch
from .. import util
import duo_client.admin


class TestAccountAdmin(unittest.TestCase):

    def setUp(self):
        child_host = 'example2.com'
        kwargs = {'ikey': 'test_ikey', 'skey': 'test_skey', 'host': 'example.com'}

        patcher = patch("duo_client.admin.AccountAdmin.get_child_api_host")
        self.mock_child_host = patcher.start()
        self.mock_child_host.return_value = child_host
        self.addCleanup(patcher.stop)

        self.client = duo_client.admin.AccountAdmin(
            'DA012345678901234567', **kwargs)
        
        # monkeypatch client's _connect()
        self.client._connect = lambda: util.MockHTTPConnection()


if __name__ == '__main__':
    unittest.main()