Ejemplo n.º 1
0
 def test_cannot_submit_transfer_in_foreign_org(self, context):
     foreign_org = Organization.api_create(context=context)
     assert_raises_http_exception(HttpStatus.CODE_FORBIDDEN,
                                  HttpStatus.MSG_FORBIDDEN,
                                  self._create_transfer,
                                  context,
                                  org_guid=foreign_org.guid,
                                  category=self.DEFAULT_CATEGORY)
Ejemplo n.º 2
0
 def setup(cls, request, test_org_manager, test_org_manager_client,
           class_context):
     cls.step("Create test org")
     cls.test_org = Organization.api_create(class_context)
     cls.step("Add org manager")
     cls.org_manager = test_org_manager
     cls.org_manager_client = test_org_manager_client
     cls.org_manager.api_add_to_organization(org_guid=cls.test_org.guid)
Ejemplo n.º 3
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)
Ejemplo n.º 4
0
 def test_user_not_in_org_cannot_get_org_users(self):
     self.step("Create new org")
     org = Organization.api_create(self.context)
     self.step(
         "Check that the user cannot get list of users in the test org")
     self.assertRaisesUnexpectedResponse(HttpStatus.CODE_FORBIDDEN,
                                         HttpStatus.MSG_FORBIDDEN,
                                         User.api_get_list_via_organization,
                                         org_guid=org.guid,
                                         client=self.manager_client)
 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
Ejemplo n.º 6
0
 def test_non_admin_cannot_delete_org(self, test_org_manager_client,
                                      context):
     step("Create an organization")
     test_org = Organization.api_create(context)
     step("Attempt to delete the organization with the non admin client")
     assertions.assert_raises_http_exception(
         UserManagementHttpStatus.CODE_FORBIDDEN,
         UserManagementHttpStatus.MSG_FORBIDDEN,
         test_org.api_delete,
         client=test_org_manager_client)
Ejemplo n.º 7
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)
Ejemplo n.º 8
0
 def test_delete_organization_with_user(self, context):
     step("Create an organization")
     test_org = Organization.api_create(context)
     step("Add new platform user to the organization")
     User.api_create_by_adding_to_organization(context, test_org.guid)
     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)
Ejemplo n.º 9
0
 def test_rename_organization(self, context):
     step("Create an organization")
     test_org = Organization.api_create(context)
     step("Update the organization, giving it new name")
     new_name = "new-{}".format(test_org.name)
     test_org.rename(new_name)
     step(
         "Check that the organization with new name is on the organization list"
     )
     orgs = Organization.api_get_list()
     assert test_org in orgs
Ejemplo n.º 10
0
 def test_create_delete_organization(self, context):
     step("Create an organization")
     test_org = Organization.api_create(context)
     step("Check that the organization is on the organization list")
     orgs = Organization.api_get_list()
     assert test_org in orgs
     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)
    def users(cls, request, admin_client, test_org_manager, test_org_manager_client, class_context):
        cls.context = class_context  # TODO no longer needed when this class removes unittest dependency
        cls.step("Create test organization")
        cls.test_org = Organization.api_create(class_context)
        cls.step("Create users for tests")
        cls.manager = User.api_create_by_adding_to_organization(class_context, org_guid=cls.test_org.guid,
                                                                roles=User.ORG_ROLES["manager"])
        cls.manager_client = cls.manager.login()
        cls.updated_user = User.api_create_by_adding_to_organization(class_context, org_guid=cls.test_org.guid, roles=[])

        cls.user_not_in_test_org = test_org_manager
        cls.client_not_in_test_org = test_org_manager_client
Ejemplo n.º 12
0
 def test_create_and_delete_org_with_special_name(self, org_name, context):
     step("Create an organization")
     test_org = Organization.api_create(context, name=org_name)
     assert org_name == test_org.name
     step("Check that the organization is on the organization list")
     orgs = Organization.api_get_list()
     assert test_org in orgs
     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)
Ejemplo n.º 13
0
def test_create_and_delete_organization(context):
    """Create and Delete Organization"""
    step("Create organization")
    test_org = Organization.api_create(context)
    step("Check that organization is on the list")
    orgs = Organization.api_get_list()
    assert test_org in orgs

    step("Delete organization")
    test_org.api_delete()
    step("Check that the organization is not on the list")
    assertions.assert_not_in_with_retry(test_org, Organization.api_get_list)
Ejemplo n.º 14
0
def test_org(request):
    context = Context()
    log_fixture("test_org: Create test organization")
    test_org = Organization.api_create(context)
    TestData.test_org = test_org

    def fin():
        log_finalizer("test_org: Delete test organization")
        context.cleanup()

    request.addfinalizer(fin)

    return test_org
Ejemplo n.º 15
0
 def test_0_check_hdfs_directory_is_created_for_new_org(
         self, class_context):
     step("Create test organization")
     self.__class__.test_org = Organization.api_create(class_context)
     hdfs_dirs = self._list_hdfs_directories("org")
     self._assert_directory_in_hdfs(hdfs_dirs,
                                    name=self.test_org.guid,
                                    owner="{}_admin".format(
                                        self.test_org.guid),
                                    group=self.test_org.guid)
     self._assert_directory_contains_subdirectories(name=self.test_org.guid)
     step("Check that organization namespace was created in hbase")
     org_namespace = self.test_org.guid.replace("-", "")
     assert org_namespace in self._get_hbase_namespaces(
         self.HBASE_PATH), "Organization namespace was not found"
Ejemplo n.º 16
0
 def user_clients(cls, request, test_org, test_space, class_context):
     cls.context = class_context  # TODO move to methods when dependency on unittest is removed
     second_test_org = Organization.api_create(class_context)
     org_manager = User.api_create_by_adding_to_organization(
         class_context, test_org.guid)
     space_manager_in_org = User.api_create_by_adding_to_space(
         class_context, test_org.guid, test_space.guid)
     org_user = User.api_create_by_adding_to_organization(
         class_context, test_org.guid, roles=User.ORG_ROLES["auditor"])
     other_org_manager = User.api_create_by_adding_to_organization(
         class_context, second_test_org.guid)
     other_user = User.api_create_by_adding_to_organization(
         class_context, second_test_org.guid, roles=[])
     cls.user_clients = {
         "admin": HttpClientFactory.get(ConsoleConfigurationProvider.get()),
         "org_manager": org_manager.login(),
         "space_manager_in_org": space_manager_in_org.login(),
         "org_user": org_user.login(),
         "other_org_manager": other_org_manager.login(),
         "other_user": other_user.login()
     }
 def setup(cls, class_context):
     cls.step("Create test org")
     cls.test_org = Organization.api_create(class_context)
     cls.step("Add org manager")
     User.api_create_by_adding_to_organization(class_context,
                                               org_guid=cls.test_org.guid)
 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
Ejemplo n.º 19
0
 def org(self, class_context):
     return Organization.api_create(class_context)
Ejemplo n.º 20
0
 def another_org(self, context):
     step("Create another test organization")
     another_org = Organization.api_create(context)
     return another_org