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_create_and_delete_catalog_image(self, context):
        """
        <b>Description:</b>
        Checks if new image can be created and deleted.

        <b>Input data:</b>
        1. image type: JAVA
        2. image state: REQUESTED

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

        <b>Steps:</b>
        1. Create image.
        2. Check that the image is on the list of catalog images.
        3. Delete the image.
        4. Check that image is no longer on the list of catalog images.
        """
        step("Create catalog image")
        catalog_image = CatalogImage.create(context,
                                            image_type=TapApplicationType.JAVA,
                                            state=TapEntityState.REQUESTED)

        step("Check that the image is on list of catalog images")
        images = CatalogImage.get_list()
        assert catalog_image in images

        step("Delete the image")
        catalog_image.delete()

        step("Check that the image was deleted")
        images = CatalogImage.get_list()
        assert catalog_image not in images

        step("Check that getting the deleted image returns an error")
        # TODO this error message should be different
        assert_raises_http_exception(CatalogHttpStatus.CODE_NOT_FOUND,
                                     CatalogHttpStatus.MSG_KEY_NOT_FOUND,
                                     CatalogImage.get,
                                     image_id=catalog_image.id)
Ejemplo n.º 3
0
    def catalog_image(self, context):
        log_fixture("CATALOG: Send application metadata - create an image")
        catalog_image = CatalogImage.create(context,
                                            image_type=self.APP_TYPE,
                                            state=self.INITIAL_IMAGE_STATE,
                                            blob_type=self.BLOB_TYPE)

        catalog_image.ensure_in_state(TapEntityState.REQUESTED)

        log_fixture("CATALOG: Check that the image is on the image list")
        catalog_images = CatalogImage.get_list()
        assert catalog_image in catalog_images
        return catalog_image
    def test_create_image_with_empty_body(self, context):
        """
        <b>Description:</b>
        Checks if there is possibility of creating image with empty body: {}.

        <b>Input data:</b>
        no input data

        <b>Expected results:</b>
        Test passes when image is created. According to this, image should be available on the list of images and
        should has automatically generated id.

        <b>Steps:</b>
        1. Create image with empty body: {}.
        """
        step("Create image with empty_body")
        catalog_image = CatalogImage.create(context)
        step("Check that the image is on the list of catalog images")
        images = CatalogImage.get_list()
        assert catalog_image in images