Skip to content

Commit

Permalink
feat: add get_passport_config() to client.Admin
Browse files Browse the repository at this point in the history
Tested-by: new test case in tests/test_passport.py
  • Loading branch information
MarkTripod-Duo committed Aug 9, 2024
1 parent 89326e3 commit ca40d6f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
18 changes: 14 additions & 4 deletions duo_client/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,16 @@
{"code": 40401, "message": "Resource not found", "stat": "FAIL"}
"""

from . import client, Accounts
from .logs.telephony import Telephony
import warnings
import base64
import json
import time
import base64
import urllib.parse
import warnings
from datetime import datetime, timedelta, timezone

from . import Accounts, client
from .logs.telephony import Telephony

USER_STATUS_ACTIVE = "active"
USER_STATUS_BYPASS = "bypass"
USER_STATUS_DISABLED = "disabled"
Expand Down Expand Up @@ -3535,6 +3536,15 @@ def get_policy_summary_v2(self):
response = self.json_api_call("GET", path, {})
return response

def get_passport_config(self):
"""
Returns the current Passport configuration.
"""

path = "/admin/v2/passport/config"
response = self.json_api_call("GET", path, {})
return response


class AccountAdmin(Admin):
"""AccountAdmin manages a child account using an Accounts API integration."""
Expand Down
13 changes: 13 additions & 0 deletions tests/admin/test_passport.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from .base import TestAdmin
from .. import util


class TestPassport(TestAdmin):
def test_get_passport(self):
""" Test get passport configuration
"""
response = self.client.get_passport_config()
(uri, args) = response['uri'].split('?')
self.assertEqual(response['method'], 'GET')
self.assertEqual(uri, '/admin/v2/passport/config')
self.assertEqual(util.params_to_dict(args), {'account_id': [self.client.account_id]})

0 comments on commit ca40d6f

Please sign in to comment.