Пример #1
0
def create_release_product(step, product_release, product_name, accept_content):

    if product_release == 'LONG_ID':
        world.product_release = LONG_ID
    else:
        world.product_release = product_release
    world.headers[ACCEPT_HEADER] = accept_content
    body = dict_to_xml(create_product_release(version=world.product_release))
    world.response = api_utils.add_product_release(headers=world.headers, body=body, product_id=product_name)
def given_a_created_product_with_name_group1(step, product_id, product_release):

    body = dict_to_xml(default_product(name=product_id))
    response = api_utils.add_new_product(headers=world.headers, body=body)
    assert_true(response.ok, response.content)
    world.product_id = response.json()[PRODUCT_NAME]
    body = dict_to_xml(create_product_release(version=product_release))
    response = api_utils.add_product_release(headers=world.headers, body=body, product_id=product_id)
    assert_true(response.ok, response.content)
Пример #3
0
def given_a_created_product_with_name_group1(step, product_id, product_release):

    body = dict_to_xml(default_product(name=product_id))
    response = api_utils.add_new_product(headers=world.headers, body=body)
    assert_true(response.ok, response.content)
    world.product_id = response.json()[PRODUCT_NAME]
    body = dict_to_xml(create_product_release(version=product_release))
    response = api_utils.add_product_release(headers=world.headers, body=body, product_id=product_id)
    assert_true(response.ok, response.content)
Пример #4
0
    def a_created_release(self, step, product_name, product_version):
        """
        Creates new release for the product if not exists, using default values.
            - Assertions:
                * Release response is OK
        :param step: Lettuce step
        :param product_name: The name of the product
        :param product_version: The version for the product release
        :return: None
        """

        response = self.api_utils.retrieve_product_release_information(headers=world.headers, product_id=product_name,
                                                                       version=product_version)
        if response.ok:
            print "WARNING: Version %s for the product %s already exists. It will not be created." % \
                  (product_version, product_name)
        else:
            body_model = create_product_release(version=product_version)
            body = body_model_to_body_request(body_model, world.headers[CONTENT_TYPE],
                                              body_model_root_element=PRODUCT_RELEASE)
            response = self.api_utils.add_product_release(headers=world.headers, body=body, product_id=product_name)
            assert_true(response.ok, response.content)