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)
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)
def test_create_and_delete_service_offering_admin( self, context, app_jar, offering_json, manifest_json, api_service_admin_client): """ <b>Description:</b> Create service offering, create an instance of it, delete instance and delete offering. <b>Input data:</b> 1. application jar file 2. manifest.json file 3. offering.json file 4. admin client <b>Expected results:</b> Test passes when: - New offering is created from application jar file. - Instance of newly created offering is created. - Instance can be deleted. - New offering can be deleted from marketplace. <b>Steps:</b> 1. Create service offering from a application jar file. 2. Create service instance. 3. Stop service instance. 4. Delete service instance. 5. Delete service offering. """ step("Register in marketplace") service = ServiceOffering.create_from_binary( context, jar_path=app_jar, manifest_path=manifest_json, offering_path=offering_json, client=api_service_admin_client) step("Check that service is in marketplace") assert_in_with_retry(service, ServiceOffering.get_list) step("Check that service is in state 'READY'") service.ensure_ready() step("Create service instance") instance = ServiceInstance.create_with_name( context, offering_label=service.label, plan_name=ServicePlan.FREE) step("Check created instance") instance.ensure_running() assert instance.offering_id == service.id assert instance.offering_label == service.label step("Stop service instance") instance.stop() instance.ensure_stopped() step("Delete service instance") instance.delete() instance.ensure_deleted() step("Delete service") service.delete(client=api_service_admin_client) step("Check that service isn't in marketplace") assert_not_in_with_retry(service, ServiceOffering.get_list)
def test_create_and_delete_organization(context): """Create and Delete Organization""" step("Create organization") test_org = Organization.create(context) step("Check that organization is on the list") orgs = Organization.get_list() assert test_org in orgs step("Delete organization") test_org.delete() step("Check that the organization is not on the list") assertions.assert_not_in_with_retry(test_org, Organization.api_get_list)
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 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)
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)
def test_create_and_delete_service(test_org, test_space, sample_python_app): step("Register in marketplace") service = ServiceType.register_app_in_marketplace( app_name=sample_python_app.name, app_guid=sample_python_app.guid, org_guid=test_org.guid, space_guid=test_space.guid) step("Check that service is in marketplace") assert_in_with_retry(service, ServiceType.api_get_list_from_marketplace, test_space.guid) step("Delete service") service.api_delete() step("Check that service isn't in marketplace") assert_not_in_with_retry(service, ServiceType.api_get_list_from_marketplace, test_space.guid)
def test_create_and_destroy_service_instance(self, context, offering_a): """ <b>Description:</b> Create and destroy service instance <b>Input data:</b> Offering <b>Expected results:</b> It's possible to create and later destroy service instance <b>Steps:</b> - Create service instance and verify it's running - Destroy service instance and verify it was removed """ step("CATALOG: Create service instance in {} state".format( TapEntityState.REQUESTED)) # REQUESTED state will trigger monitor to grab the instance from catalog and send it to container-broker queue instance = CatalogServiceInstance.create( context, service_id=offering_a.id, plan_id=offering_a.plans[0].id, state=TapEntityState.REQUESTED) step( "Wait for the monitor and container-broker to move the instance to RUNNING state" ) instance.ensure_in_state(expected_state=TapEntityState.RUNNING) step("KUBERNETES: Check that corresponding pod exists and is running") pods = self._assert_pod_count_with_retry(instance_id=instance.id, expected_pod_count=1) assert pods[0].state == KubernetesPod.RUNNING step("CATALOG: Stop service instance") instance.stop() step("CATALOG: Destroy service instance and check it's gone") instance.destroy() assertions.assert_not_in_with_retry( instance, CatalogServiceInstance.get_list_for_service, service_id=offering_a.id) step("KUBERNETES: Check that the pod does not exist") self._assert_pod_count_with_retry(instance_id=instance.id, expected_pod_count=0)
def test_push_and_delete_application(self, context, test_sample_apps, api_service_admin_client): """ <b>Description:</b> Attempts to push application, stop it and then delete it. <b>Input data:</b> - Sample application - Admin credentials <b>Expected results:</b> - Application is successfully pushed to platform - Apllication is in running state - It's possible to stop the application - it's possible to remove the application - After removal application is no longer available <b>Steps:</b> - Sample application is downloaded - Manifest is updated with unique name - Application is pushed to platform using admin - It's verified that the application is in running state - Application is stopped and it's verified that the application has stopped - Remove the application and verify it's no longer available """ log_fixture("sample_application: update manifest") p_a = PrepApp(test_sample_apps[self.SAMPLE_APP].filepath) manifest_params = {"type" : self.APP_TYPE} manifest_path = p_a.update_manifest(params=manifest_params) step("Push sample application") application = Application.push(context, app_path=test_sample_apps[self.SAMPLE_APP].filepath, name=p_a.app_name, manifest_path=manifest_path, client=api_service_admin_client) step("Check application is running") application.ensure_running() step("Stop application") application.stop() application.ensure_stopped() step("Delete application") application.delete() step("Check that application is not on the list") assertions.assert_not_in_with_retry(application, Application.get_list, client=api_service_admin_client)
def test_delete_invitation(self, tap_cli, invitation): """ <b>Description:</b> Delete invitation. <b>Input data:</b> 1. Invitation <b>Expected results:</b> Invitation is successfully deleted and no longer visible in active invitations list <b>Steps:</b> 1. Delete invitation. 2. Check that invitation is no longer present in invitations list. """ step("Deleting invitation...") invitation.delete() step("Ensuring invitation has been removed") assert_not_in_with_retry(invitation, CliInvitation.get_list, tap_cli)
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)
def test_delete_user(self, client, is_authorized): test_user = User.api_create_by_adding_to_organization( self.context, TestData.test_org.guid) step("Try to delete user from space using every client type") test_user.api_add_to_space(org_guid=TestData.test_org.guid, space_guid=TestData.test_space.guid) self._assert_user_in_space_with_roles(test_user, TestData.test_space.guid) if is_authorized: test_user.api_delete_from_space(TestData.test_space.guid, client=self.user_clients[client]) assert_not_in_with_retry(test_user, User.api_get_list_via_space, TestData.test_space.guid) else: assert_raises_http_exception(HttpStatus.CODE_FORBIDDEN, HttpStatus.MSG_FORBIDDEN, test_user.api_delete_from_space, TestData.test_space.guid, client=self.user_clients[client]) assert test_user in User.api_get_list_via_space( TestData.test_space.guid), "User was deleted"
def test_delete_user(self, tap_cli, test_org, user): """ <b>Description:</b> Delete user. <b>Input data:</b> 1. User <b>Expected results:</b> User is successfully deleted and no longer visible in users list <b>Steps:</b> 1. Delete user. 2. Check that user is no longer present in users list. """ step("Deleting user...") tap_cli.delete_user(user.username) step("Ensuring {} has been removed from user list".format( user.username)) assert_not_in_with_retry(user, User.get_all_users, org_guid=test_org.guid)