diff --git a/duo_client/admin.py b/duo_client/admin.py index 94de697..d1cb5a3 100644 --- a/duo_client/admin.py +++ b/duo_client/admin.py @@ -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" @@ -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.""" diff --git a/tests/admin/test_passport.py b/tests/admin/test_passport.py new file mode 100644 index 0000000..ef06b0d --- /dev/null +++ b/tests/admin/test_passport.py @@ -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]})