Skip to content
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
9 changes: 7 additions & 2 deletions cvprac/cvp_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,13 @@ def get_cert_login_info(self):
CvpApiError: A CvpApiError is raised if the request is made
without a valid certificate based authentication session.
'''
return self.clnt.get('/aaa/v1/certLoginInfo',
timeout=self.request_timeout)
if self.clnt.cert_login:
return self.clnt.get('/aaa/v1/certLoginInfo',
timeout=self.request_timeout)
else:
self.log.warning(
"get_cert_login_info is only available when using certificate authentication"
)
Comment thread
chetryan marked this conversation as resolved.

# pylint: disable=too-many-arguments
def add_user(self, username, password, role, status, first_name,
Expand Down
2 changes: 2 additions & 0 deletions test/unit/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ def test_get_cert_login_info(self):
"""Test cert login info request."""
self.clnt.get = Mock(return_value={'username': 'certuser'})

self.clnt.cert_login = True
result = self.api.get_cert_login_info()
self.clnt.cert_login = False

self.clnt.get.assert_called_once_with('/aaa/v1/certLoginInfo',
timeout=30)
Expand Down
Loading