Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add get_passport_config() to client.Admin #272

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]})
Loading