File: test_namespace.py

package info (click to toggle)
python-hvac 2.3.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,800 kB
  • sloc: python: 29,360; makefile: 42; sh: 14
file content (23 lines) | stat: -rw-r--r-- 949 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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):
        test_namespace_name = "python-hvac"
        create_namespace_response = self.client.sys.create_namespace(
            path=test_namespace_name
        )
        logging.debug("create_namespace_response: %s" % create_namespace_response)

        # Verify the namespace we just created is retrievable in a listing.
        list_namespaces_response = self.client.sys.list_namespaces()
        logging.debug("list_namespaces_response: %s" % list_namespaces_response)
        self.assertIn(
            member="%s/" % test_namespace_name,
            container=list_namespaces_response["data"]["keys"],
        )