File: test_verification_push.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 (30 lines) | stat: -rw-r--r-- 1,192 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
30
import json
from .. import util
from .base import TestAdmin


class TestVerificationPush(TestAdmin):
    def test_send_verification_push(self):
        """
        Test sending a verification push to a user.
        """
        response = self.client.send_verification_push('test_user_id', 'test_phone_id')
        self.assertEqual(response['method'], 'POST')
        self.assertEqual(response['uri'],
                         '/admin/v1/users/test_user_id/send_verification_push')
        self.assertEqual(
           json.loads(response['body']),
            {'phone_id': 'test_phone_id', 'account_id': self.client.account_id})

    def test_get_verification_push_response(self):
        """
        Test getting the verification push response.
        """
        response = self.client.get_verification_push_response('test_user_id', 'test_push_id')
        (uri, args) = response['uri'].split('?')
        self.assertEqual(response['method'], 'GET')
        self.assertEqual(uri, '/admin/v1/users/test_user_id/verification_push_response')

        self.assertEqual(
            util.params_to_dict(args),
            {'push_id': ['test_push_id'], 'account_id': [self.client.account_id]})