Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jeffrey Hogan
committed
Jul 7, 2019
1 parent
f14caac
commit 2e5839b
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from hvac.api.system_backend.system_backend_mixin import SystemBackendMixin | ||
|
||
|
||
class Namespace(SystemBackendMixin): | ||
|
||
def list_namespaces(self): | ||
"""Lists all the namespaces. | ||
Supported methods: | ||
LIST: /sys/namespaces. Produces: 200 application/json | ||
:return: The JSON response of the request. | ||
:rtype: dict | ||
""" | ||
api_path = '/v1/sys/namespaces/' | ||
response = self._adapter.list( | ||
url=api_path, | ||
) | ||
return response.json() |
19 changes: 19 additions & 0 deletions
19
tests/integration_tests/api/system_backend/test_namespace.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import logging | ||
from unittest import TestCase, skipIf | ||
|
||
from tests import utils | ||
from tests.utils.hvac_integration_test_case import HvacIntegrationTestCase | ||
|
||
|
||
@skipIf(not utils.is_enterprise(), "Namespaces only supported with Enterprise Vault") | ||
class TestNamespace(HvacIntegrationTestCase, TestCase): | ||
|
||
def test_list_namespaces(self): | ||
|
||
# List the lease of our test cert that was just issued. | ||
list_namespaces_response = self.client.sys.list_namespaces() | ||
logging.debug('list_namespaces_response: %s' % list_namespaces_response) | ||
self.assertIsInstance( | ||
obj=list_namespaces_response, | ||
cls=list, | ||
) |