mirror of
https://github.com/cve-search/PyVulnerabilityLookup.git
synced 2024-11-25 08:17:20 +00:00
new: get user profile
Some checks failed
Python application - MyPy / Python 3.10 sample (push) Has been cancelled
Python application - MyPy / Python 3.11 sample (push) Has been cancelled
Python application - MyPy / Python 3.12 sample (push) Has been cancelled
Python application - MyPy / Python 3.8 sample (push) Has been cancelled
Python application - MyPy / Python 3.9 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.10 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.11 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.12 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.8 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.9 sample (push) Has been cancelled
Some checks failed
Python application - MyPy / Python 3.10 sample (push) Has been cancelled
Python application - MyPy / Python 3.11 sample (push) Has been cancelled
Python application - MyPy / Python 3.12 sample (push) Has been cancelled
Python application - MyPy / Python 3.8 sample (push) Has been cancelled
Python application - MyPy / Python 3.9 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.10 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.11 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.12 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.8 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.9 sample (push) Has been cancelled
This commit is contained in:
parent
6e504075a1
commit
e4ed7ed1f6
2 changed files with 17 additions and 0 deletions
|
@ -211,3 +211,8 @@ class PyVulnerabilityLookup():
|
|||
'''List users'''
|
||||
r = self.session.get(urljoin(self.root_url, str(PurePosixPath('api', 'user'))))
|
||||
return r.json()
|
||||
|
||||
def get_user_information(self) -> dict[str, Any]:
|
||||
'''Get user information'''
|
||||
r = self.session.get(urljoin(self.root_url, str(PurePosixPath('api', 'user', 'me'))))
|
||||
return r.json()
|
||||
|
|
|
@ -253,6 +253,18 @@ class TestPublic(unittest.TestCase):
|
|||
self.assertTrue(len(comments["data"]) == 0)
|
||||
|
||||
# Test User
|
||||
def test_users_info(self) -> None:
|
||||
if not self.admin_token:
|
||||
# this test is only working if the admin token is set
|
||||
return None
|
||||
# Makes sure the userkey is set to the right one
|
||||
self.client.set_apikey(self.admin_token)
|
||||
user_info = self.client.get_user_information()
|
||||
self.assertTrue(isinstance(user_info, dict))
|
||||
self.assertTrue('login' in user_info)
|
||||
self.assertTrue('apikey' in user_info)
|
||||
self.assertEqual(user_info['apikey'], self.admin_token)
|
||||
|
||||
def test_list_users(self) -> None:
|
||||
if not self.admin_token:
|
||||
# this test is only working if the admin token is set
|
||||
|
|
Loading…
Reference in a new issue