api.v1.test_images

Tests for images.

caseautomation:automated
casecomponent:api
caseimportance:high
caselevel:integration
requirement:Cloud Meter
testtype:functional
upstream:yes
integrade.tests.api.v1.test_images.images_data()

Create test data for the tests on this module.

To be able to verify that the image API endpoing works we need:

  • One super user acccount
  • Two regular user account
  • Image data for each user
integrade.tests.api.v1.test_images.test_challenge_image(superuser, method)

Test if a challenge flags for RHEL and OS can be changed.

Id:

ec5fe0b6-9852-48db-a2ba-98d01aeaac28

Description:

Try to change challenge flags on an image and ensure that change is reflected afterwards.

Steps:
  1. Create an image in a known account and make sure the challenge flags are false by default.
  2. Use both PUT and PATCH forms of the image endpoint to set a flag to true
Expectedresults:
 

The image data now reflects this change.

integrade.tests.api.v1.test_images.test_list_all_images(images_data, superuser)

Test if images can be listed.

Id:

9b103387-4868-4f30-ab61-47fc54e2f41f

Description:

Check if a regular user can fetch all of its images and if a superuser can fetch all images on the system or filter the images by any user.

Steps:
  1. List all images using a regular user. Check if the returned images are only the ones that belong to the user.
  2. List all images on the system using a superuser. Also check if a superuser can filter the list of images by user.
Expectedresults:
 

A regular user can only list its images and a superuser can fetch all images or filter by user.

integrade.tests.api.v1.test_images.test_list_specific_image(images_data)

Test if a specific image can be fetched.

Id:

99aaec58-6053-476d-9674-ee650ffa33a9

Description:

Check if a regular user can fetch one of its images. Check if a superuser can fetch all images. Check if a regular user can’t fetch an image that belongs to another user.

Steps:
  1. Fetch all images
  2. For each image, check if its owner and a superuser can fetch each. Also check if another user can’t fetch it.
Expectedresults:
 

A regular user can only fetch its images and a superuser can fetch all images.

integrade.tests.api.v1.test_images.usertype(superuser)

Generate a test id based on the user type.