File: test_authlog.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 (29 lines) | stat: -rw-r--r-- 1,072 bytes parent folder | download | duplicates (2)
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
from .. import util
import duo_client.admin
from .base import TestAdmin


class TestEndpoints(TestAdmin):
    def test_get_authentication_log_v1(self):
        """ Test to get authentication log on version 1 api.
        """
        response = self.client_list.get_authentication_log(api_version=1)[0]
        uri, args = response['uri'].split('?')

        self.assertEqual(response['method'], 'GET')
        self.assertEqual(uri, '/admin/v1/logs/authentication')
        self.assertEqual(
            util.params_to_dict(args)['account_id'],
            [self.client_list.account_id])

    def test_get_authentication_log_v2(self):
        """ Test to get authentication log on version 1 api.
        """
        response = self.client_authlog.get_authentication_log(api_version=2)
        uri, args = response['uri'].split('?')

        self.assertEqual(response['method'], 'GET')
        self.assertEqual(uri, '/admin/v2/logs/authentication')
        self.assertEqual(
            util.params_to_dict(args)['account_id'],
            [self.client_authlog.account_id])