コード例 #1
0
 def test_add_space(self):
     step("Try to add new space using every client type.")
     errors = []
     for client in self.user_clients:
         try:
             space_list = Space.api_get_list_in_org(
                 org_guid=TestData.test_org.guid)
             if self.SPACE_PERMISSION[client]:
                 new_space = Space.api_create(
                     TestData.test_org, client=self.user_clients[client])
                 space_list = Space.api_get_list()
                 assert new_space in space_list, "Space was not created."
             else:
                 assert_raises_http_exception(
                     HttpStatus.CODE_FORBIDDEN,
                     HttpStatus.MSG_FORBIDDEN,
                     Space.api_create,
                     TestData.test_org,
                     client=self.user_clients[client])
                 assert Space.api_get_list_in_org(
                     org_guid=TestData.test_org.guid
                 ) == space_list, "Space was created"
         except Exception as e:
             errors.append(e)
     assert_no_errors(errors)
コード例 #2
0
 def test_delete_organization_with_space(self, context):
     step("Create an organization")
     test_org = Organization.api_create(context)
     step("Create a space")
     Space.api_create(org=test_org)
     step("Delete the organization")
     test_org.api_delete()
     step("Check that the organization is not on org list")
     assertions.assert_not_in_with_retry(test_org,
                                         Organization.api_get_list)
コード例 #3
0
def test_create_and_delete_space(core_org):
    """Create and Delete Space"""
    step("Create new space")
    test_space = Space.api_create(org=core_org)
    step("Check that the space was created")
    spaces = Space.api_get_list()
    assert test_space in spaces
    step("Delete the space")
    test_space.api_delete()
    step("Check that the space was deleted")
    assertions.assert_not_in_with_retry(test_space, Space.api_get_list)
コード例 #4
0
 def space_and_users(cls, request, test_org, class_context):
     cls.test_space = Space.api_create(org=test_org)
     cls.test_users = [
         User.api_create_by_adding_to_organization(class_context,
                                                   org_guid=test_org.guid)
         for _ in range(2)
     ]
コード例 #5
0
    def space(self, request, test_org, test_org_manager):
        self.step("Create test space")
        self.test_space = Space.api_create(test_org)

        def fin():
            self.test_space.cleanup()

        request.addfinalizer(fin)
コード例 #6
0
 def __init__(self):
     self.apps = len(Application.cf_api_get_list())
     self.service_instances = len(ServiceInstance.cf_api_get_list())
     self.services = len(ServiceType.cf_api_get_list())
     self.buildpacks = len(Buildpack.cf_api_get_list())
     self.orgs = len(Organization.cf_api_get_list())
     self.spaces = len(Space.cf_api_get_list())
     self.users = len(User.cf_api_get_all_users())
コード例 #7
0
 def test_0_no_clusters_for_new_organization(self, class_context):
     step("Get list of clusters")
     clusters_before = KubernetesCluster.demiurge_api_get_list()
     step("Create organization and space")
     self.__class__.test_org = Organization.api_create(class_context)
     self.__class__.test_space = Space.api_create(org=self.test_org)
     step("Check that there are no new clusters created")
     clusters_after = KubernetesCluster.demiurge_api_get_list()
     assert len(clusters_before) == len(clusters_after)
コード例 #8
0
 def org_space_app(self, context):
     step("Create test organization and space")
     test_org = Organization.api_create(context)
     test_space = Space.api_create(test_org)
     step("Login to cf targeting test org and test space")
     cf.cf_login(test_org.name, test_space.name)
     step("Push example app")
     example_app_path = ApplicationPath.SAMPLE_PYTHON_APP
     test_app = Application.push(context, space_guid=test_space.guid, source_directory=example_app_path)
     return test_org, test_space, test_app
コード例 #9
0
 def test_cannot_get_user_list_from_deleted_space(self):
     self.step("Create and delete the space")
     deleted_space = Space.api_create(TestData.test_org)
     deleted_space.cleanup()
     self.step(
         "Check that retrieving list of users in the deleted space returns an error"
     )
     self.assertRaisesUnexpectedResponse(HttpStatus.CODE_NOT_FOUND,
                                         HttpStatus.MSG_NOT_FOUND,
                                         User.api_get_list_via_space,
                                         deleted_space.guid)
コード例 #10
0
 def test_delete_space(self):
     step("Try to delete space using every client type.")
     errors = []
     for client in self.user_clients:
         try:
             new_space = Space.api_create(TestData.test_org)
             if self.SPACE_PERMISSION[client]:
                 new_space.api_delete(client=self.user_clients[client])
                 assert_not_in_with_retry(new_space, Space.api_get_list)
             else:
                 assert_raises_http_exception(
                     HttpStatus.CODE_FORBIDDEN,
                     HttpStatus.MSG_FORBIDDEN,
                     new_space.api_delete,
                     client=self.user_clients[client])
                 space_list = Space.api_get_list_in_org(
                     org_guid=TestData.test_org.guid)
                 assert new_space in space_list, "Space was not deleted"
         except Exception as e:
             errors.append(e)
     assert_no_errors(errors)
コード例 #11
0
 def test_get_service_instance_summary_from_empty_space(self):
     self.step("Create a service instance in one space")
     service_type = next(s for s in self.marketplace
                         if s.label == ServiceLabels.KAFKA)
     ServiceInstance.api_create(
         org_guid=TestData.test_org.guid,
         space_guid=TestData.test_space.guid,
         service_label=service_type.label,
         service_plan_guid=service_type.service_plan_guids[0])
     test_space = Space.api_create(TestData.test_org)
     self.step("Get service instance summary in another space")
     summary = ServiceInstance.api_get_keys(test_space.guid)
     self.step(
         "Check that service instance summary is empty in the second space")
     self.assertEqual(summary, {})
コード例 #12
0
 def org_space(self, context):
     step("Create test organization and space")
     test_org = Organization.api_create(context)
     test_space = Space.api_create(test_org)
     return test_org, test_space
コード例 #13
0
def test_space(request, test_org):
    log_fixture("test_space: Create test space")
    TestData.test_space = Space.api_create(test_org)
    return TestData.test_space
コード例 #14
0
 def space(self, org):
     return Space.api_create(org=org)
コード例 #15
0
 def space(cls, test_org):
     cls.step("Create test space")
     cls.test_space = Space.api_create(test_org)
コード例 #16
0
 def space(cls, request, test_org):
     cls.test_org = test_org
     cls.step("Create test space")
     cls.test_space = Space.api_create(cls.test_org)
     request.addfinalizer(
         lambda: fixtures.delete_or_not_found(cls.test_space.api_delete))
コード例 #17
0
 def space(cls, request, test_org, test_org_manager):
     cls.test_org = test_org
     cls.test_user = test_org_manager
     cls.step("Create test space")
     cls.test_space = Space.api_create(cls.test_org)
コード例 #18
0
def core_space():
    log_fixture("core_space: Create object for core space")
    ref_space_name = config.core_space_name
    spaces = Space.cf_api_get_list()
    TestData.core_space = next(s for s in spaces if s.name == ref_space_name)
    return TestData.core_space