Ejemplo n.º 1
0
    def test_role(self):

        VERBS = ["get", "list", "create", "delete", "update"]
        namespace_created = namespace.create(configuration, "testdemo")
        self.assertEqual(namespace_created, True)
        role_created = role.create(configuration, "testdemo", ROLE_NAME, VERBS,
                                   VERBS)
        self.assertEqual(role_created, True)
        namespace_deleted = namespace.delete(configuration, "testdemo")
        self.assertEqual(namespace_deleted, True)
Ejemplo n.º 2
0
    def test_role_binding(self):
        NAMESPACE_NAME = "testdemo"
        VERBS = ["get", "list", "create", "delete", "update"]

        namespace_created = namespace.create(configuration, NAMESPACE_NAME)
        self.assertEqual(namespace_created, True)
        role_created = role.create(configuration, NAMESPACE_NAME, ROLE_NAME,
                                   VERBS, VERBS)
        self.assertEqual(role_created, True)
        role_binding_created = role_binding.create(configuration,
                                                   NAMESPACE_NAME, ROLE_NAME,
                                                   "test_label", "test_user")
        self.assertEqual(role_binding_created, True)
        namespace_deleted = namespace.delete(configuration, NAMESPACE_NAME)
        self.assertEqual(namespace_deleted, True)
 def test_namespace_incorrect(self):
     namespace_created = namespace.create(configuration, "test_demo", False)
     self.assertEqual(namespace_created, False)
Ejemplo n.º 4
0
for data in requirement_yml:
    for key, value in data.items():
        if "requirements" in key:
            for i in value:
                REQUIREMENT_DATA.append(i)

configuration = client.Configuration()
configuration.host = CLUSTER_URL
configuration.verify_ssl = False
configuration.api_key['authorization'] = API_KEY

for i in REQUIREMENT_DATA:
    NAMESPACE_NAME = i["namespace"]
    USER_NAME = i["user"]
    namespace_created = namespace.create(configuration, NAMESPACE_NAME)
    if namespace_created:
        print("Namespace Named " + NAMESPACE_NAME + " Created")
    else:
        print("ERROR While Creating Namespace!!")
        exit()

    role_created = role.create(configuration, NAMESPACE_NAME, ROLE_NAME,
                               POD_VERBS, DEVELOPMENT_VERBS)

    if role_created:
        print("Role Named " + ROLE_NAME + " Created")
    else:
        print("ERROR While Creating Role!!")
        exit()
 def test_namespace_correct(self):
     namespace_created = namespace.create(configuration, "testdemo")
     self.assertEqual(namespace_created, True)
     namespace_deleted = namespace.delete(configuration, "testdemo")
     self.assertEqual(namespace_deleted, True)