def test_login_providing_invalid_credentials(self):
        """
        <b>Description:</b>
        Tries to login to platform with invalid credentials

        <b>Input data:</b>
        - Invalid credentials

        <b>Expected results:</b>
        It's not possible to log in to platform with invalid credentials

        <b>Steps:</b>
        - Login with bad credentials and verify it's not possible
        """
        step("Login providing invalid credentials")
        client = self._get_client(username=generate_test_object_name(),
                                  password=generate_test_object_name())

        assert_raises_http_exception(ApiServiceHttpStatus.CODE_UNAUTHORIZED,
                                     self.MSG_INVALID_CREDENTIALS_PROVIDED,
                                     client.request,
                                     method=HttpMethod.GET,
                                     path="login",
                                     raw_response=True,
                                     msg="Login with invalid credentials")
 def create_offering_json(cls,
                          name: str = None,
                          description: str = None,
                          metadata: list = None,
                          bindable: bool = True,
                          tags: list = None,
                          plans: list = None,
                          file_name: str = None):
     default_plans = [{
         "name": ServicePlanNames.FREE,
         "description": ServicePlanNames.FREE,
         "cost": ServicePlanNames.FREE
     }]
     offering_dict = {
         "name":
         name if name is not None else generate_test_object_name(
             separator="-"),
         "description":
         description
         if description is not None else generate_test_object_name(),
         "metadata":
         metadata if metadata is not None else [],
         "bindable":
         bindable,
         "tags":
         tags if tags is not None else [],
         "plans":
         plans if plans is not None else default_plans
     }
     file_name = file_name if file_name is not None else "offering.json"
     return file_utils.save_text_file(data=json.dumps(offering_dict),
                                      file_name=file_name)
    def test_4_check_messages_flow(self, ws2kafka_app):
        """
        <b>Description:</b>
        Checks if messages send through ws2kafka can be retrieved by hbase application.

        <b>Input data:</b>
        1. Ws2kafka application.
        2. Hbase application.

        <b>Expected results:</b>
        Hbase can read the messages.

        <b>Steps:</b>
        1. Send messages.
        2. Verify the messages was received.
        """
        @retry(AssertionError, tries=10, delay=2)
        def _assert_messages_in_hbase():
            rows = self.hbase_reader.get_first_rows_from_table(
                self.db_and_table_name)
            hbase_messages = [
                row["columnFamilies"][0]["columnValues"][0]["value"]
                for row in rows
            ]
            step("Check that messages from kafka were sent to hbase")
            assert messages[0][::-1] in hbase_messages and messages[1][::-1] in hbase_messages, \
                "No messages in hbase"

        messages = [generate_test_object_name(short=True) for _ in range(2)]
        self._send_messages(ws2kafka_app.urls[0], messages, self.TOPIC_IN)
        _assert_messages_in_hbase()
 def test_cannot_create_service_instance_with_name_of_an_existing_instance(
         self):
     existing_name = generate_test_object_name()
     self.step("Create service instance")
     instance = ServiceInstance.api_create_with_plan_name(
         org_guid=TestData.test_org.guid,
         space_guid=TestData.test_space.guid,
         service_label=ServiceLabels.KAFKA,
         name=existing_name,
         service_plan_name=ServicePlan.SHARED)
     service_list = ServiceInstance.api_get_list(
         space_guid=TestData.test_space.guid)
     self.step("Check that the instance was created")
     self.assertIn(instance, service_list, "Instance was not created")
     errors = []
     for service_type in self.marketplace:
         plan_guid = next(iter(service_type.service_plan_guids))
         self.step("Try to create {} service instance".format(
             service_type.label))
         with self.assertRaises(UnexpectedResponseError) as e:
             ServiceInstance.api_create(TestData.test_org.guid,
                                        TestData.test_space.guid,
                                        service_type.label,
                                        existing_name,
                                        service_plan_guid=plan_guid)
         if e is None or e.exception.status != HttpStatus.CODE_CONFLICT:
             errors.append(
                 "Service '{}' failed to respond with given error status.".
                 format(service_type.label))
     assert_no_errors(errors)
     self.assertUnorderedListEqual(
         service_list,
         ServiceInstance.api_get_list(space_guid=TestData.test_space.guid),
         "Some new services were created")
    def create(cls,
               context,
               tap_cli,
               offering_name,
               plan_name,
               name=None,
               envs=None):
        """Creates service instance on platform

        Args:
            context: object context which defined moment of cleanup (e.g. class_context)
            tap_cli: instance Cli client of TAP
            offering_name: name of offering (e.g. mongodb-30)
            plan_name: offering's plan name (e.g. single-small)
            name: name of service instance
            envs: list of environment variables to set inside container
            of created service instance.

        Returns:
            Instance of service instance object.
        """
        name = name if name is not None else \
            test_names.generate_test_object_name(separator="-", short=True)
        cmd = CliService.create_args_list(name, offering_name, plan_name, envs)
        tap_cli.create_service(cmd)
        context.test_objects.append(
            cls(offering_name=offering_name,
                plan_name=plan_name,
                name=name,
                tap_cli=tap_cli))
        cli_service = cls.get(name, tap_cli)
        cli_service.ensure_service_state(TapEntityState.RUNNING)
        return cli_service
Example #6
0
    def prepare_test(cls, test_org, test_space, add_admin_to_test_org,
                     login_to_cf, psql_app, request):
        step("Create a table in postgres DB")
        cls.test_table_name = generate_test_object_name(
            prefix=DbInput.test_table_name)
        cls.TEST_TABLE = Table.post(psql_app, cls.test_table_name,
                                    cls.TEST_COLUMNS)
        Row.post(psql_app, cls.test_table_name, cls.TEST_ROWS[0])
        step("Create tunnel to cdh-master-0")
        cls.SSH_TUNNEL = SshTunnel(hostname=config.cdh_master_0_hostname,
                                   username=config.jumpbox_username,
                                   path_to_key=config.jumpbox_key_path,
                                   port=WebhdfsTools.DEFAULT_PORT,
                                   via_hostname=config.jumpbox_hostname,
                                   via_port=22,
                                   local_port=WebhdfsTools.DEFAULT_PORT)
        cls.SSH_TUNNEL.connect()
        step("Get psql credentials")
        PSQL_CREDENTIALS = Psql.get_credentials(psql_app)
        cls.db_hostname, cls.db_name, cls.username, cls.password, cls.port = PSQL_CREDENTIALS
        cls.WEBHDFS = WebhdfsTools.create_client(host=cls.TEST_HOST)

        def fin():
            cls.SSH_TUNNEL.disconnect()
            for table in Table.TABLES:
                table.delete()

        request.addfinalizer(fin)
    def test_create_image_with_image_id(self, context):
        """
        <b>Description:</b>
        Checks if new image with the given id can be created.

        <b>Input data:</b>
        1. image id: generated test name
        2. image type: JAVA
        3. image state: REQUESTED

        <b>Expected results:</b>
        Test passes when new image can be created. According to this, image should be available on the list of images
        after being created.

        <b>Steps:</b>
        1. Create image with the given id.
        2. Check that the image is on the list of catalog images.
        """
        step("Create image with image_id")
        catalog_image = CatalogImage.create(
            context,
            image_id=generate_test_object_name(),
            image_type=TapApplicationType.JAVA,
            state=TapEntityState.REQUESTED)
        step("Check that the image is on the list of catalog images")
        images = CatalogImage.get_list()
        assert catalog_image in images
    def test_0_create_gateway_instance(self, class_context,
                                       test_org_user_client):
        """
        <b>Description:</b>
        Check that by creating a gateway instance the gateway application is created.

        <b>Input data:</b>
        1. user client

        <b>Expected results:</b>
        Test passes when gateway instance is successfully created.

        <b>Steps:</b>
        1. Create gateway instance with plan single.
        2. Check that gateway instance is running.
        3. Check that gateway application was created.
        """
        step("Create gateway instance")
        gateway_instance = ServiceInstance.create_with_name(
            class_context,
            name=test_names.generate_test_object_name(separator="",
                                                      short=True),
            offering_label=ServiceLabels.GATEWAY,
            plan_name=ServicePlan.SINGLE,
            client=test_org_user_client)
        gateway_instance.ensure_running()
        validator = ApplicationStackValidator(gateway_instance)
        self.__class__.gateway_instance = gateway_instance
        self.__class__.gateway_app = validator.application
    def test_cannot_create_service_instance_with_invalid_plan_id(
            self, etcd_offering, api_service_admin_client):
        """
        <b>Description:</b>
        Tries to create service instance with invalid plan id

        <b>Input data:</b>
        - Admin credentials

        <b>Expected results:</b>
        It's not possible to create service with invalid plan id

        <b>Steps:</b>
        Create a service instance with invalid plan id
        """
        valid_name = generate_test_object_name(separator="")
        step("Send create service instance request with invalid plan_id")
        assertions.assert_raises_http_exception(
            ApiServiceHttpStatus.CODE_BAD_REQUEST,
            ApiServiceHttpStatus.MSG_PLAN_CANNOT_BE_FOUND.format(
                Guid.INVALID_GUID),
            api.create_service,
            client=api_service_admin_client,
            name=valid_name,
            plan_id=Guid.INVALID_GUID,
            offering_id=etcd_offering.id,
            params=None)
Example #10
0
    def create(cls,
               context,
               tap_cli,
               name: str = None,
               plans: list = None,
               template_body=template_example.etcd_template["body"]):
        if name is None:
            name = generate_test_object_name(short=True, separator="")
        if plans is None:
            plans = [
                ServicePlan(plan_id=None, name="test", description="test")
            ]
        assert all([isinstance(sp, ServicePlan) for sp in plans])
        offering_template = cls._create_offering_template(
            template_body=template_body,
            service_name=name,
            description=cls.OFFERING_DESC,
            bindable=True,
            tags=["test"],
            plans=[sp.to_dict() for sp in plans])

        file_path = save_text_file(file_name=name,
                                   data=json.dumps(offering_template))
        create_output = tap_cli.create_offering(file_path)
        assert cls.EXPECTED_CREATE_OFFERING_SUCCESS in create_output, "Create offering failed: {}".format(
            create_output)
        new_offering = cls(name=name, plans=plans, tap_cli=tap_cli)
        context.test_objects.append(new_offering)
        return new_offering
Example #11
0
    def test_create_service_with_tag(self, context, app_jar, manifest_json):
        """
        <b>Description:</b>
        Create new service offering with tag.

        <b>Input data:</b>
        1. application jar file
        2. manifest.json file

        <b>Expected results:</b>
        Test passes when new offering is created with tags.

        <b>Steps:</b>
        1. Prepare offering json file with tags.
        2. Create service offering.
        3. Check that created offering is present on the offering list.
        4. Check that offering has custom tags.
        """
        step("Prepare offering json")
        tags = [generate_test_object_name(short=True)]
        offering_file = ServiceOffering.create_offering_json(tags=tags)
        step("Register in marketplace")
        service = ServiceOffering.create_from_binary(
            context,
            jar_path=app_jar,
            manifest_path=manifest_json,
            offering_path=offering_file)
        step("Check that service is in marketplace")
        assert_in_with_retry(service, ServiceOffering.get_list)
        step("Check that tags names are the same")
        assert tags == service.tags
Example #12
0
def test_add_new_user_to_and_delete_from_org(core_org, context):
    """
    <b>Description:</b>
    Checks if admin user can be added and removed from the platform.

    <b>Input data:</b>
    1. User email.

    <b>Expected results:</b>
    Test passes when admin user was successfully added to the platform and removed from it.

    <b>Steps:</b>
    1. Onboard new user to the platform.
    2. Update user role to admin
    3. Verify the user is present in the organization.
    4. Remove the user from the organization.
    5. Verify that the user was removed from the organization.
    """
    step("Add new user to organization")
    username = generate_test_object_name(email=True, separator="")
    test_user = onboarding.onboard(context=context,
                                   org_guid=core_org.guid,
                                   username=username,
                                   check_email=False)
    test_user.update_org_role(org_guid=core_org.guid,
                              new_role=User.ORG_ROLE["admin"])
    step("Check that the user is added")
    users = User.get_list_in_organization(org_guid=core_org.guid)
    assert test_user in users
    step("Delete the user from the organization")
    test_user.delete_from_organization(org_guid=core_org.guid)
    step("Check that the user is not in the organization")
    users = User.get_list_in_organization(org_guid=core_org.guid)
    assert test_user not in users
Example #13
0
    def test_1_create_service_instance(self):
        step("Get list of services to retrieve a {} service".format(
            ServiceTag.K8S))
        services = ServiceType.api_get_list_from_marketplace(
            space_guid=self.test_space.guid)
        service = next((s for s in services if ServiceTag.K8S in s.tags), None)
        if service is None:
            raise AssertionError("No {} service available".format(
                ServiceTag.K8S))

        step("Create instance")
        self.__class__.test_instance = ServiceInstance.api_create(
            org_guid=self.test_org.guid,
            space_guid=self.test_space.guid,
            name=test_names.generate_test_object_name(short=True),
            service_label=service.label,
            service_plan_guid=service.service_plans[0]["guid"])

        step("Check that the instance is on the list")
        instances = ServiceInstance.api_get_list(
            space_guid=self.test_space.guid)
        assert self.test_instance in instances

        step("Check that new cluster is created")
        self.__class__.cluster = KubernetesCluster.demiurge_api_get(
            name=self.test_org.guid)
    def __init__(self, context, org_uuid, space_uuid, tap_http_client):
        self.service_instance = ServiceInstance.api_create_with_plan_name(
            context,
            org_uuid,
            space_uuid,
            ServiceLabels.SEAHORSE,
            name=generate_test_object_name(short=True,
                                           prefix=ServiceLabels.SEAHORSE),
            service_plan_name=ServicePlan.FREE)
        self.service_instance.ensure_running()
        self.seahorse_url = "{}-{}.{}".format(
            self.service_instance.name.replace("_", "-"),
            self.service_instance.guid, self.tap_domain)
        self.seahorse_http_url = "https://{}".format(self.seahorse_url)

        http_client_configuration = HttpClientConfiguration(
            client_type=HttpClientType.NO_AUTH,
            url="https://{}".format(self.seahorse_url),
            username=self.username,
            password=self.password)
        self.http_client = HttpClientFactory.get(http_client_configuration)
        self.http_client.session = tap_http_client.session

        self._ensure_seahorse_accessible()
        self._ensure_authorized()
        self._ensure_wm_accessible()
        self._ensure_sm_accessible()

        self._ws = None
Example #15
0
    def test_cannot_create_an_account_with_invalid_code(
            self, context, test_org):
        """
        <b>Description:</b>
        Checks if user account cannot be created with invalid registration code.

        <b>Input data:</b>
        1. Email address.
        2. User password.

        <b>Expected results:</b>
        Test passes when 403 Forbidden HTTP status is returned on attempt of registering a user without valid code.

        <b>Steps:</b>
        1. An error is returned when user registers with invalid code.
        """
        step("An error is returned when user registers with invalid code")
        username = generate_test_object_name(email=True)
        assert_raises_http_exception(
            HttpStatus.CODE_FORBIDDEN,
            HttpStatus.MSG_EMPTY,
            onboarding.register,
            context=context,
            org_guid=test_org.guid,
            code="FFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF",
            username=username)
class TestKubernetes:
    service_name = test_names.generate_test_object_name(short=True)
    test_service = None
    test_instance = None

    def test_1_create_dynamic_service(self, core_org, core_space):
        step("Create new service offering in kubernetes broker")
        service_name = ServiceType.k8s_broker_create_dynamic_service(core_org.guid, core_space.guid,
                                                                     service_name=self.service_name)
        step("Check the new offering is in kubernetes-broker catalog")
        catalog = ServiceType.k8s_broker_get_catalog()
        kubernetes_service = next((s for s in catalog if s.label == service_name), None)
        assert kubernetes_service is not None

    def test_2_enable_service_access(self, core_space):
        step("Check service is available in cloud foundry")
        cf_services = ServiceType.cf_api_get_list(name=self.service_name, get_plans=True)
        assert len(cf_services) == 1
        self.__class__.test_service = cf_services[0]

        step("Enable service access")
        self.test_service.cf_api_enable_service_access()
        self.test_service.space_guid = core_space.guid

        step("Check the service is visible in marketplace")
        marketplace = ServiceType.api_get_list_from_marketplace(space_guid=core_space.guid)
        assert self.test_service in marketplace

    def test_3_create_instance_of_dynamic_kubernetes_service(self, core_org, core_space):
        step("Create instance of the new service and check it's on the list")
        self.__class__.test_instance = ServiceInstance.api_create(
            org_guid=core_org.guid,
            space_guid=core_space.guid,
            service_label=self.service_name,
            service_plan_guid=self.test_service.service_plans[0]["guid"]
        )
        instances = ServiceInstance.api_get_list(space_guid=core_space.guid)
        self.test_instance.ensure_created()
        assert self.test_instance in instances

    def test_4_delete_instance_of_kubernetes_service(self, core_space):
        step("Delete instance and check it's no longer on the list")
        self.test_instance.api_delete()
        instances = ServiceInstance.api_get_list(space_guid=core_space.guid)
        assert self.test_instance not in instances

    def test_5_disable_service_access(self, core_space):
        step("Disable service access")
        self.test_service.cf_api_disable_service_access()
        step("Check the service is not visible in marketplace")
        marketplace = ServiceType.api_get_list_from_marketplace(space_guid=core_space.guid)
        assert self.test_service not in marketplace

    def test_6_delete_dynamic_service(self):
        step("Delete created dynamic service")
        ServiceType.k8s_broker_delete_dynamic_service(service_name=self.service_name)
        step("Check that deleted service is not in kubernetes-broker catalog")
        catalog = ServiceType.k8s_broker_get_catalog()
        kubernetes_service = next((s for s in catalog if s.label == self.service_name), None)
        assert kubernetes_service is None
    def test_create_and_delete_table(self, db_type, db_type_key):
        """
        <b>Description:</b>
        Checks if a table can be created and deleted.

        <b>Input data:</b>
        1. sql-api-example app with bound database

        <b>Expected results:</b>
        A table was created and then deleted.

        <b>Steps:</b>
        1. Create a table.
        2. Verify the table was created.
        3. Delete the table.
        4. Verify the table was deleted.
        """
        app = db_type[db_type_key]
        self.__class__.test_table_name = generate_test_object_name(prefix=DbInput.test_table_name)
        test_table = Table.post(app, self.test_table_name, self.test_columns)
        table_list = Table.get_list(app)
        assert test_table in table_list
        test_table.delete()
        table_list = Table.get_list(app)
        assert test_table not in table_list
 def create(cls,
            context,
            *,
            org_guid,
            description=None,
            name=None,
            creation_tool=None,
            revision=None,
            algorithm=None,
            artifacts=None,
            added_by=None,
            added_on=None,
            modified_by=None,
            modified_on=None,
            client=None):
     if name is None:
         name = generate_test_object_name()
     response = model_catalog_api.insert_model(org_guid=org_guid,
                                               name=name,
                                               creation_tool=creation_tool,
                                               revision=revision,
                                               algorithm=algorithm,
                                               description=description,
                                               artifacts=artifacts,
                                               added_by=added_by,
                                               added_on=added_on,
                                               modified_by=modified_by,
                                               modified_on=modified_on,
                                               client=client)
     new_model = cls._from_response(response=response)
     context.test_objects.append(new_model)
     return new_model
Example #19
0
def test_onboarding(context, test_org):
    """
    <b>Description:</b>
    Checks if user can be added to the platform with onboarding functionality.

    <b>Input data:</b>
    1. User email.

    <b>Expected results:</b>
    Test passes when user was successfully added to the platform with onboading functionality.

    <b>Steps:</b>
    1. Onboard new user to the platform.
    2. Get list of all users on the platform.
    3. Verify that the user is present on the platform.
    """
    step("Onboard new user")
    username = generate_test_object_name(email=True, separator="")
    test_user = onboarding.onboard(context=context,
                                   org_guid=test_org.guid,
                                   username=username,
                                   check_email=False)
    step("Check that user is created")
    users = User.get_all_users(test_org.guid)
    assert test_user in users
Example #20
0
    def test_user_cannot_register_without_password(self, context, test_org):
        """
        <b>Description:</b>
        Checks if the user registration without password fails.

        <b>Input data:</b>
        1. Email address.

        <b>Expected results:</b>
        Test passes when 400 Bad request HTTP status is returned on attempt of user registration without password and
        the user is not created.

        <b>Steps:</b>
        1. Invite a user.
        2. Check that an error is returned when the user tries to register without a password.
        3. Check that the user was not created.
        """
        step("Invite a new user")
        invitation = Invitation.api_send(context)
        step(
            "Check that an error is returned when the user tries to register without a password"
        )
        assert_raises_http_exception(HttpStatus.CODE_BAD_REQUEST,
                                     HttpStatus.MSG_PASSWORD_CANNOT_BE_EMPTY,
                                     user_management.api_register_new_user,
                                     code=invitation.code,
                                     org_name=generate_test_object_name())
        step("Check that the user was not created")
        username_list = [
            user.username for user in User.get_all_users(test_org.guid)
        ]
        assert invitation.username not in username_list, "User was created"
Example #21
0
    def test_non_admin_user_cannot_invite_another_user(self, context,
                                                       test_org):
        """
        <b>Description:</b>
        Checks if non-admin user cannot invite other user.

        <b>Input data:</b>
        1. Email address.
        2. User password.

        <b>Expected results:</b>
        Test passes when non-admin user receives access denied reply on adding other user attempt and the user doesn't
        obtain an invitation.

        <b>Steps:</b>
        1. Create a test user.
        2. Check an error is returned when non-admin tries to onboard another user.
        """
        step("Create a test user")
        user = User.create_by_adding_to_organization(
            context=context,
            org_guid=test_org.guid,
            role=User.ORG_ROLE["user"])
        non_admin_user_client = user.login()
        step(
            "Check an error is returned when non-admin tries to onboard another user"
        )
        username = generate_test_object_name(email=True)
        assert_raises_http_exception(HttpStatus.CODE_FORBIDDEN,
                                     HttpStatus.MSG_ACCESS_IS_DENIED,
                                     Invitation.api_send,
                                     context,
                                     username=username,
                                     inviting_client=non_admin_user_client)
        self._assert_user_received_messages(username, 0)
    def test_submit_transfer_from_txt_file(self, category, context, test_org):
        """
        <b>Description:</b>
        Check that transfer can be created from a txt file in any category.

        <b>Input data:</b>
        1. organization id
        2. transfer category
        3. test file

        <b>Expected results:</b>
        Test passes when transfer and dataset are successfully created from a txt file
        and are visible in the test organization.

        <b>Steps:</b>
        1. Create transfer from a txt file.
        2. Retrieve created transfer and dataset.
        3. Check that created transfer and dataset are visible in the test organization.
        """
        step("Create txt file name")
        txt_file_name = "{}.txt".format(generate_test_object_name())
        step("Create transfer from file")
        transfer, dataset = create_dataset_from_file(
            context=context,
            org_guid=test_org.guid,
            file_path=generate_csv_file(file_name=txt_file_name),
            category=category)
        TestSubmitTransfer.check_transfer_and_dataset_are_visible_in_test_org(
            transfer=transfer, dataset=dataset, test_org=test_org)
    def test_no_token_in_create_transfer_response(self, test_org):
        """
        <b>Description:</b>
        Check that create transfer from an url response doesn't contain a 'token' field.

        <b>Input data:</b>
        1. organization id
        2. url with a source file

        <b>Expected results:</b>
        Test passes when create transfer response doesn't contain a 'token' field.

        <b>Steps:</b>
        1. Send valid create transfer request.
        2. Check that in the response there is no 'token' field.
        """
        step(
            "Create new transfer and check that 'token' field was not returned in response"
        )
        response = das.api_create_transfer(source=self.transfer_url,
                                           title=generate_test_object_name(),
                                           is_public=False,
                                           org_guid=test_org.guid,
                                           category=self.DEFAULT_CATEGORY)
        assert "token" not in response, "token field was returned in response"
Example #24
0
 def send(cls, context, *, tap_cli, username=None):
     if username is None:
         username = test_names.generate_test_object_name(email=True)
     tap_cli.login()
     tap_cli.invite(username)
     new_invitation = cls(tap_cli=tap_cli, username=username)
     context.test_objects.append(new_invitation)
     return new_invitation
 def test_delete_not_existing_dynamic_service(self):
     step("Try to delete not existing dynamic service")
     invalid_service_name = test_names.generate_test_object_name(short=True)
     self.assertRaisesUnexpectedResponse(
         HttpStatus.CODE_GONE,
         "",
         kubernetes_broker.k8s_broker_delete_service,
         service_name=invalid_service_name)
Example #26
0
 def create(cls, context, *, application_id, name=None, instance_type=TYPE, state=TapEntityState.REQUESTED):
     if name is None:
         name = generate_test_object_name().replace("_", "-")
     response = catalog_api.create_application_instance(application_id=application_id, name=name,
                                                        instance_type=instance_type, state=state)
     new_instance = cls._from_response(response)
     context.test_objects.append(new_instance)
     return new_instance
Example #27
0
 def test_cannot_create_new_user_with_long_username(self):
     long_username = "******" * 300 + generate_test_object_name(email=True)
     self.assertRaisesUnexpectedResponse(HttpStatus.CODE_BAD_REQUEST,
                                         HttpStatus.MSG_EMPTY,
                                         User.api_create_by_adding_to_space,
                                         self.context,
                                         self.test_org.guid,
                                         self.test_space.guid,
                                         username=long_username)
 def create(cls, context, *, template_id, name=None, description=None, bindable=True, state=None, plans=None):
     if name is None:
         name = generate_test_object_name().replace("_", "-")
     if plans is None:
         plans = [ServicePlan(plan_id=None, name="test", description="test")]
     response = catalog_api.create_service(template_id=template_id, name=name, description=description,
                                           bindable=bindable, state=state, plans=[sp.to_dict() for sp in plans])
     new_service = cls._from_response(response)
     context.test_objects.append(new_service)
     return new_service
Example #29
0
 def create(cls, context, *, offering_id: str, plan_id: str, name: str=None,
            params: dict=None, client: HttpClient=None):
     if name is None:
         name = generate_test_object_name(separator="")
     if client is None:
         client = cls._get_default_client()
     response = api.create_service(name=name, plan_id=plan_id, params=params, offering_id=offering_id, client=client)
     instance = cls._from_response(response, client)
     context.test_objects.append(instance)
     return instance
Example #30
0
 def test_no_token_in_create_transfer_response(self, test_org):
     step(
         "Create new transfer and check that 'token' field was not returned in response"
     )
     response = das.api_create_transfer(source=Urls.test_transfer_link,
                                        title=generate_test_object_name(),
                                        is_public=False,
                                        org_guid=test_org.guid,
                                        category=self.DEFAULT_CATEGORY)
     assert "token" not in response, "token field was returned in response"