glance.tests.unit.v1 package

Submodules

glance.tests.unit.v1.test_api module

class glance.tests.unit.v1.test_api.TestAPIPropertyQuotas(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest

setUp()[source]

Establish a clean test environment

test_update_image_with_too_many_properties()[source]

Ensure that updating image properties enforces the quota.

test_update_image_with_too_many_properties_without_purge_props()[source]

Ensure that updating image properties counts existing image propertys when enforcing property quota.

test_update_properties_without_purge_props_overwrite_value()[source]

Ensure that updating image properties does not count against image property quota.

class glance.tests.unit.v1.test_api.TestAPIProtectedProps(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest

destroy_fixtures()[source]
setUp()[source]

Establish a clean test environment

tearDown()[source]

Clear the test environment

test_create_locked_down_protected_prop()[source]

Verify a property protected by special char ‘!’ is creatable by no one

test_create_non_protected_prop()[source]

Verify property marked with special char ‘@’ is creatable by an unknown role

test_create_protected_prop_check_case_insensitive()[source]

Verify that role check is case-insensitive i.e. the property marked with role Member is creatable by the member role

test_delete_locked_down_protected_prop()[source]

Verify a property protected by special char ‘!’ is deletable by no one

test_delete_non_protected_prop()[source]

Verify property marked with special char ‘@’ is deletable by an unknown role

test_delete_protected_props_check_case_insensitive()[source]

Verify that role check is case-insensitive i.e. the property marked with role Member is deletable by the member role

test_delete_protected_props_mix_no_read()[source]

Create an image with two props - one only readable by admin, and one readable/deletable by member. Verify member can successfully delete their property while the admin owned one is ignored transparently

test_delete_protected_props_mix_read()[source]

Create an image with two props - one readable/deletable by admin, but also readable by spl_role. The other is readable/deletable by spl_role. Verify spl_role is forbidden to purge_props in this scenario without retaining the readable prop.

test_prop_protection_update_noop()[source]

Test protected property update is allowed as long as the user has read access and the value is unchanged

test_prop_protection_update_without_read()[source]

Test protected property cannot be updated without read permission

test_prop_protection_with_create_and_permitted_role()[source]

As admin role, create an image and verify permitted role ‘member’ can create a protected property

test_prop_protection_with_create_and_unpermitted_role()[source]

As admin role, create an image and verify unpermitted role ‘fake_member’ can not create a protected property

test_prop_protection_with_delete_and_permitted_policy()[source]

As admin role, create an image with protected property, and verify permitted role ‘member’ can can delete that protected property

test_prop_protection_with_delete_and_permitted_role()[source]

As admin role, create an image with protected property, and verify permitted role ‘member’ can can delete that protected property

test_prop_protection_with_delete_and_unpermitted_delete()[source]

Test protected property cannot be deleted without delete permission

test_prop_protection_with_delete_and_unpermitted_read()[source]

Test protected property cannot be deleted without read permission

test_prop_protection_with_detail_and_permitted_policy()[source]

As admin role, create an image with a protected property, and verify permitted role ‘member’ can read that protected property via /images/detail

test_prop_protection_with_detail_and_permitted_role()[source]

As admin role, create an image with a protected property, and verify permitted role ‘member’ can read that protected property via /images/detail

test_prop_protection_with_detail_and_unpermitted_policy()[source]

As admin role, create an image with a protected property, and verify permitted role ‘fake_role’ can not read that protected property via /images/detail

test_prop_protection_with_detail_and_unpermitted_role()[source]

As admin role, create an image with a protected property, and verify permitted role ‘fake_role’ can not read that protected property via /images/detail

test_prop_protection_with_get_and_permitted_role()[source]

As admin role, create an image with a protected property, and verify permitted role ‘member’ can read that protected property via GET

test_prop_protection_with_get_and_unpermitted_role()[source]

As admin role, create an image with a protected property, and verify permitted role ‘fake_role’ can not read that protected property via GET

test_prop_protection_with_permitted_policy_config()[source]

As admin role, create an image and verify permitted role ‘member’ can create a protected property

test_prop_protection_with_show_and_permitted_role()[source]

As admin role, create an image with a protected property, and verify permitted role ‘member’ can read that protected property via HEAD

test_prop_protection_with_show_and_unpermitted_role()[source]

As admin role, create an image with a protected property, and verify permitted role ‘fake_role’ can not read that protected property via HEAD

test_prop_protection_with_update_and_permitted_policy()[source]

As admin role, create an image with protected property, and verify permitted role ‘admin’ can update that protected property

test_prop_protection_with_update_and_permitted_role()[source]

As admin role, create an image with protected property, and verify permitted role ‘member’ can update that protected property

test_prop_protection_with_update_and_unpermitted_policy()[source]

As admin role, create an image with protected property, and verify unpermitted role ‘fake_role’ can not update that protected property

test_prop_protection_with_update_and_unpermitted_role()[source]

As admin role, create an image with protected property, and verify unpermitted role ‘fake_role’ can not update that protected property

test_read_locked_down_protected_prop()[source]

Verify a property protected by special char ‘!’ is readable by no one

test_read_non_protected_prop()[source]

Verify property marked with special char ‘@’ is readable by an unknown role

test_read_protected_prop_check_case_insensitive()[source]

Verify that role check is case-insensitive i.e. the property marked with role Member is readable by the member role

test_read_protected_props_leak_with_update()[source]

Verify when updating props that ones we don’t have read permission for are not disclosed

test_update_locked_down_protected_prop()[source]

Verify a property protected by special char ‘!’ is updatable by no one

test_update_non_protected_prop()[source]

Verify property marked with special char ‘@’ is updatable by an unknown role

test_update_protected_props_check_case_insensitive()[source]

Verify that role check is case-insensitive i.e. the property marked with role Member is updatable by the member role

test_update_protected_props_mix_no_read()[source]

Create an image with two props - one only readable by admin, and one readable/updatable by member. Verify member can successfully update their property while the admin owned one is ignored transparently

test_update_protected_props_mix_read()[source]

Create an image with two props - one readable/updatable by admin, but also readable by spl_role. The other is readable/updatable by spl_role. Verify spl_role can successfully update their property but not the admin owned one

class glance.tests.unit.v1.test_api.TestFilterValidator(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest

test_filter_validator()[source]
class glance.tests.unit.v1.test_api.TestGlanceAPI(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest

create_fixtures()[source]
destroy_fixtures()[source]
setUp()[source]

Establish a clean test environment

test_active_image_immutable_props_for_user()[source]

Tests user cannot update immutable props of active image

test_add_check_no_url_info_both_off()[source]
test_add_check_no_url_info_both_on()[source]
test_add_check_no_url_info_direct_url()[source]
test_add_check_no_url_info_ml()[source]
test_add_copy_from_image_authorized_upload_image_authorized()[source]
test_add_copy_from_image_unauthorized()[source]
test_add_copy_from_upload_image_unauthorized()[source]
test_add_copy_from_upload_image_unauthorized_with_body()[source]
test_add_copy_from_with_location()[source]

Tests creates an image from copy-from and location

test_add_copy_from_with_nonempty_body()[source]

Tests creates an image from copy-from and nonempty body

test_add_copy_from_with_restricted_sources()[source]

Tests creates an image from copy-from with restricted sources

test_add_image_bad_store()[source]

Tests raises BadRequest for invalid store header

test_add_image_basic_file_store()[source]

Tests to add a basic image in the file store

test_add_image_checksum_and_size_mismatch()[source]
test_add_image_checksum_mismatch()[source]
test_add_image_no_location_no_content_type()[source]

Tests creates a queued image for no body and no loc header

test_add_image_no_location_no_image_as_body()[source]

Tests creates a queued image for no body and no loc header

test_add_image_size_chunked_data_too_big()[source]
test_add_image_size_data_exceed_quota()[source]
test_add_image_size_data_exceed_quota_readd()[source]
test_add_image_size_data_too_big()[source]
test_add_image_size_header_exceed_quota()[source]
test_add_image_size_header_too_big()[source]

Tests raises BadRequest for supplied image size that is too big

test_add_image_size_mismatch()[source]
test_add_image_unauthorized()[source]
test_add_image_wrong_content_type()[source]
test_add_image_zero_size()[source]

Tests creating an active image with explicitly zero size

test_add_location_with_conflict_image_size()[source]

Tests creates an image from location and conflict image size

test_add_location_with_invalid_location_on_conflict_image_size()[source]

Tests creates an image from location and conflict image size

test_add_location_with_invalid_location_on_restricted_sources()[source]

Tests creates an image from location and restricted sources

test_add_location_with_nonempty_body()[source]

Tests creates an image from location and nonempty body

test_add_member_allowed_by_policy()[source]
test_add_member_forbidden_by_policy()[source]
test_add_member_non_existing_image()[source]

Tests adding image members raises right exception

test_add_member_overlimit()[source]
test_add_member_positive()[source]

Tests adding image members

test_add_member_unauthorized()[source]

Tests adding image members raises right exception

test_add_member_unlimited()[source]
test_add_member_with_body()[source]

Tests adding image members

test_add_publicize_image_authorized()[source]
test_add_publicize_image_unauthorized()[source]
test_bad_checksum_prevents_image_creation()[source]

Test that the image contents are checksummed properly

test_bad_container_format()[source]
test_bad_disk_format()[source]
test_bad_image_name()[source]
test_bad_image_size()[source]
test_bad_min_disk_size_create()[source]
test_bad_min_disk_size_update()[source]
test_bad_min_ram_size_create()[source]
test_bad_min_ram_size_update()[source]
test_bad_time_create_low_year()[source]
test_bad_time_create_minus_int()[source]
test_bad_time_create_string()[source]
test_bad_time_create_string_in_date()[source]
test_configured_container_format_bad()[source]
test_configured_container_format_good()[source]
test_configured_disk_format_bad()[source]
test_configured_disk_format_good()[source]
test_container_and_disk_amazon_format_differs()[source]
test_create_delayed_image_with_no_disk_and_container_formats()[source]
test_create_image_with_nonexistent_location_url()[source]
test_create_image_with_too_many_properties()[source]
test_create_member_to_deleted_image_raises_404()[source]

Tests adding members to deleted image raises 404.

test_create_with_bad_store_name()[source]
test_create_with_empty_copy_from()[source]
test_create_with_empty_location()[source]
test_create_with_location_bad_store_uri()[source]
test_create_with_location_get_store_or_400_raises_exception(*args, **keywargs)[source]
test_create_with_location_no_container_format()[source]
test_create_with_location_no_disk_format()[source]
test_create_with_location_unknown_scheme()[source]
test_deactivated_image_immutable_props_for_user()[source]

Tests user cannot update immutable props of deactivated image

test_defaulted_amazon_format()[source]
test_delete_deleted_image()[source]

Tests that exception raised trying to delete a deleted image

test_delete_during_image_upload_by_admin()[source]
test_delete_during_image_upload_by_normal_user()[source]
test_delete_image()[source]
test_delete_image_member()[source]
test_delete_image_unauthorized()[source]
test_delete_member()[source]

Tests deleting image members raises right exception

test_delete_member_allowed_by_policy()[source]
test_delete_member_forbidden_by_policy()[source]
test_delete_member_of_deleted_image_raises_404()[source]

Tests deleting members of deleted image raises 404.

test_delete_member_on_non_existing_image()[source]

Tests deleting image members raises right exception

test_delete_non_exist_member()[source]

Test deleting image members raises right exception

test_delete_non_exists_image()[source]
test_delete_not_allowed()[source]
test_delete_pending_delete_image()[source]

Tests that correct response returned when deleting a pending_delete image

test_delete_protected_image()[source]
test_delete_queued_image()[source]

Delete an image in a queued state

Bug #747799 demonstrated that trying to DELETE an image that had had its save process killed manually results in failure because the location attribute is None.

Bug #1048851 demonstrated that the status was not properly being updated to ‘deleted’ from ‘queued’.

test_delete_queued_image_delayed_delete()[source]

Delete an image in a queued state when delayed_delete is on

Bug #1048851 demonstrated that the status was not properly being updated to ‘deleted’ from ‘queued’.

test_disable_purge_props()[source]

Test the special x-glance-registry-purge-props header controls the purge property behaviour of the registry. :see LP Bug#901534

test_download_deactivated_images()[source]

Tests exception raised trying to download a deactivated image

test_download_service_unavailable()[source]

Test image download returns HTTPServiceUnavailable.

test_etag_equals_checksum_header()[source]

Test that the ETag header matches the x-image-meta-checksum

test_get_details_filter_changes_since()[source]

Tests that the /images/detail API returns list of images that changed since the time defined by changes-since

test_get_details_invalid_marker()[source]

Tests that the /images/detail API returns a 400 when an invalid marker is provided

test_get_image_members()[source]

Tests members listing for existing images

test_get_image_members_allowed_by_policy()[source]
test_get_image_members_forbidden_by_policy()[source]
test_get_image_members_not_existing()[source]

Tests proper exception is raised if attempt to get members of non-existing image

test_get_images_bad_urls()[source]

Check that routes collections are not on (LP bug 1185828)

test_get_images_detailed_unauthorized()[source]
test_get_images_unauthorized()[source]
test_get_index_filter_on_user_defined_properties()[source]

Check that image filtering works on user-defined properties

test_get_index_sort_name_asc()[source]

Tests that the /images API returns list of public images sorted alphabetically by name in ascending order.

test_get_member_images()[source]

Tests image listing for members

test_get_members_of_deleted_image_raises_404()[source]

Tests members listing for deleted image raises 404.

test_head_details()[source]
test_image_is_checksummed()[source]

Test that the image contents are checksummed properly

test_image_meta()[source]

Test for HEAD /images/<ID>

test_image_meta_unauthorized()[source]
test_image_status_when_delete_fails()[source]

Tests that the image status set to active if deletion of image fails.

test_invalid_min_disk_size_update()[source]
test_invalid_min_ram_size_update()[source]
test_post_image_content_missing_container_type()[source]

Tests creation of an image with missing container format

test_post_image_content_missing_disk_format()[source]

Tests creation of an image with missing disk format

test_props_of_active_image_mutable_for_admin()[source]

Tests admin can update ‘immutable’ props of active image

test_props_of_deactivated_image_mutable_for_admin()[source]

Tests admin can update ‘immutable’ props of deactivated image

test_publicize_image_unauthorized()[source]

Create a non-public image then fail to make public

test_put_image_content_missing_container_type()[source]

Tests delayed activation of image with missing container format

test_put_image_content_missing_disk_format()[source]

Tests delayed activation of image with missing disk format

test_register_and_upload()[source]

Test that the process of registering an image with some metadata, then uploading an image file with some more metadata doesn’t mark the original metadata deleted :see LP Bug#901534

test_replace_members()[source]

Tests replacing image members raises right exception

test_replace_members_allowed_by_policy()[source]
test_replace_members_bad_request()[source]

Tests replacing image members raises bad request if body is wrong

test_replace_members_forbidden_by_policy()[source]
test_replace_members_non_existing_image()[source]

Tests replacing image members raises right exception

test_replace_members_of_image()[source]
test_replace_members_of_image_overlimit()[source]
test_replace_members_of_image_unlimited()[source]
test_replace_members_positive()[source]

Tests replacing image members

test_show_image_basic()[source]
test_show_image_restricted_download_for_core_property()[source]
test_show_image_restricted_download_for_custom_property()[source]
test_show_image_store_get_not_support(*args, **keywargs)[source]
test_show_image_store_random_get_not_support(*args, **keywargs)[source]
test_show_image_unauthorized()[source]
test_show_image_unauthorized_download()[source]
test_show_non_exists_image()[source]
test_store_location_not_revealed()[source]

Test that the internal store location is NOT revealed through the API server

test_update_copy_from_unauthorized()[source]
test_update_copy_from_upload_image_unauthorized()[source]
test_update_data_upload_bad_store_uri()[source]
test_update_data_upload_image_unauthorized()[source]
test_update_deleted_image()[source]

Tests that exception raised trying to update a deleted image

test_update_image_size_chunked_data_too_big()[source]
test_update_image_size_data_too_big()[source]
test_update_image_size_header_too_big()[source]

Tests raises BadRequest for supplied image size that is too big

test_update_members_of_deleted_image_raises_404()[source]

Tests update members of deleted image raises 404.

test_update_non_existing_image()[source]
test_update_public_image()[source]
test_update_without_public_attribute(*args, **keywargs)[source]
test_updating_imageid_after_creation()[source]
test_upload_image_http_nonexistent_location_url()[source]
test_upload_image_raises_store_disabled()[source]

Test that uploading an image file returns HTTTP 410 response

test_upload_safe_kill(*args, **keywargs)[source]
test_upload_safe_kill_deleted(*args, **keywargs)[source]
test_upload_to_image_status_saving()[source]

Test image upload conflict.

If an image is uploaded before an existing upload to the same image completes, the original upload should succeed and the conflicting one should fail and any data be deleted.

class glance.tests.unit.v1.test_api.TestImageSerializer(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest

setUp()[source]

Establish a clean test environment

test_image_send_notification()[source]
test_image_send_notification_error()[source]

Ensure image.send notification is sent on error.

test_meta()[source]
test_meta_utf8()[source]
test_noop_redact_location()[source]

Check no-op location redaction does not change original metadata

test_redact_location()[source]

Ensure location redaction does not change original metadata

test_show()[source]
test_show_notify()[source]

Make sure an eventlet posthook for notify_image_sent is added.

glance.tests.unit.v1.test_registry_api module

class glance.tests.unit.v1.test_registry_api.TestRegistryAPI(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest, glance.tests.utils.RegistryAPIMixIn

setUp()[source]

Establish a clean test environment

tearDown()[source]

Clear the test environment

test_add_image_member_non_shared_image_forbidden()[source]

Test update image members raises right exception

test_add_member()[source]

Tests adding image members raises right exception

test_add_member_delete_create()[source]

Test check that the same member can be successfully added after delete it, and the same record will be reused for the same membership.

test_add_member_to_image_bad_request()[source]

Test check right status code is returned

test_add_member_to_image_positive()[source]

Test check that member can be successfully added

test_add_member_to_non_exist_image()[source]

Test check that member can’t be added for non exist image

test_create_image()[source]

Tests that the /images POST registry API creates the image

test_create_image_with_bad_id()[source]

Tests proper exception is raised if a bad disk_format is set

test_create_image_with_bad_status()[source]

Tests proper exception is raised if a bad status is set

test_create_image_with_image_id_in_log()[source]

Tests correct image id in log message when creating image

test_create_image_with_min_disk()[source]

Tests that the /images POST registry API creates the image

test_create_image_with_min_disk_default()[source]

Tests that the /images POST registry API creates the image

test_create_image_with_min_ram()[source]

Tests that the /images POST registry API creates the image

test_create_image_with_min_ram_default()[source]

Tests that the /images POST registry API creates the image

test_delete_image()[source]

Tests that the /images DELETE registry API deletes the image

test_delete_image_member_non_shared_image_forbidden()[source]

Test delete image members raises right exception

test_delete_image_not_existing()[source]

Tests proper exception is raised if attempt to delete non-existing image

test_delete_image_response()[source]

Tests that the registry API delete returns the image metadata

test_delete_member()[source]

Tests deleting image members raises right exception

test_delete_member_from_non_exist_image()[source]

Tests deleting image members raises right exception

test_delete_member_invalid()[source]

Tests deleting a invalid/non existing member raises right exception

test_delete_private_image_no_admin()[source]

Tests proper exception is raised if attempt to delete private image with non admin user, that not belongs to it

test_delete_public_image_no_admin()[source]

Tests proper exception is raised if attempt to delete public image with non admin user

test_get_details()[source]

Tests that the /images/detail registry API returns a mapping containing a list of detailed image information

test_get_details_filter_changes_since()[source]

Tests that the /images/detail registry API returns list of images that changed since the time defined by changes-since

test_get_details_filter_container_format()[source]

Tests that the /images/detail registry API returns list of public images that have a specific container_format

test_get_details_filter_deleted_false()[source]

Test that the /images/detail registry API return list of images with deleted filter = false

test_get_details_filter_disk_format()[source]

Tests that the /images/detail registry API returns list of public images that have a specific disk_format

test_get_details_filter_min_disk()[source]

Tests that the /images/detail registry API returns list of public images that have a specific min_disk

test_get_details_filter_min_ram()[source]

Tests that the /images/detail registry API returns list of public images that have a specific min_ram

test_get_details_filter_name()[source]

Tests that the /images/detail registry API returns list of public images that have a specific name

test_get_details_filter_property()[source]

Tests that the /images/detail registry API returns list of public images that have a specific custom property

test_get_details_filter_public_false()[source]

Tests that the /images/detail registry API returns list of private images if is_public false is passed

test_get_details_filter_public_none()[source]

Tests that the /images/detail registry API returns list of all images if is_public none is passed

test_get_details_filter_public_string_format()[source]

Tests that the /images/detail registry API returns 400 Bad error for filter is_public with wrong format

test_get_details_filter_public_true()[source]

Tests that the /images/detail registry API returns list of public images if is_public true is passed (same as default)

test_get_details_filter_size_max()[source]

Tests that the /images/detail registry API returns list of public images that have a size less than or equal to size_max

test_get_details_filter_size_min()[source]

Tests that the /images/detail registry API returns list of public images that have a size greater than or equal to size_min

test_get_details_filter_size_min_max()[source]

Tests that the /images/detail registry API returns list of public images that have a size less than or equal to size_max and greater than or equal to size_min

test_get_details_filter_status()[source]

Tests that the /images/detail registry API returns list of public images that have a specific status

test_get_details_forbidden_marker()[source]

Tests that the /images/detail registry API returns a 400 when a forbidden marker is provided

test_get_details_invalid_marker()[source]

Tests that the /images/detail registry API returns a 400 when an invalid marker is provided

test_get_details_limit_marker()[source]

Tests that the /images/details registry API returns list of public images that conforms to limit and marker query params. This functionality is tested more thoroughly on /images, this is just a sanity check

test_get_details_malformed_marker()[source]

Tests that the /images/detail registry API returns a 400 when a malformed marker is provided

test_get_details_sort_name_asc()[source]

Tests that the /images/details registry API returns list of public images sorted alphabetically by name in ascending order.

test_get_filter_no_public_with_no_admin()[source]

Tests that the /images/detail registry API returns list of public images if is_public true is passed (same as default)

test_get_filter_protected_with_None_value()[source]

Tests that the /images/detail registry API returns 400 error

test_get_filter_protected_with_True_value()[source]

Tests that the /images/detail registry API returns 400 error

test_get_image_members()[source]

Tests members listing for existing images

test_get_image_members_forbidden()[source]

Tests proper exception is raised if attempt to get members of non-existing image

test_get_image_members_not_existing()[source]

Tests proper exception is raised if attempt to get members of non-existing image

test_get_images_bad_urls()[source]

Check that routes collections are not on (LP bug 1185828)

test_get_index()[source]

Tests that the /images registry API returns list of public images

test_get_index_bad_sort_dir()[source]

Ensure a 400 is returned when a bad sort_dir is provided.

test_get_index_bad_sort_key()[source]

Ensure a 400 is returned when a bad sort_key is provided.

test_get_index_filter_name()[source]

Tests that the /images registry API returns list of public images that have a specific name. This is really a sanity check, filtering is tested more in-depth using /images/detail

test_get_index_filter_on_user_defined_properties()[source]

Tests that /images registry API returns list of public images based a filter on user-defined properties.

test_get_index_forbidden_marker()[source]

Tests that the /images registry API returns a 400 when a forbidden marker is provided

test_get_index_limit()[source]

Tests that the /images registry API returns list of public images that conforms to a limit query param

test_get_index_limit_marker()[source]

Tests that the /images registry API returns list of public images that conforms to limit and marker query params

test_get_index_limit_negative()[source]

Tests that the /images registry API returns list of public images that conforms to a limit query param

test_get_index_limit_non_int()[source]

Tests that the /images registry API returns list of public images that conforms to a limit query param

test_get_index_malformed_marker()[source]

Tests that the /images registry API returns a 400 when a malformed marker is provided

test_get_index_marker()[source]

Tests that the /images registry API returns list of public images that conforms to a marker query param

test_get_index_null_container_format()[source]

Check 200 is returned when sort_key is null container_format

Check 200 is returned when sort_key is container_format and container_format is null for specified marker

test_get_index_null_disk_format()[source]

Check 200 is returned when sort_key is null disk_format

Check 200 is returned when sort_key is disk_format and disk_format is null for specified marker

test_get_index_null_name()[source]

Check 200 is returned when sort_key is null name

Check 200 is returned when sort_key is name and name is null for specified marker

test_get_index_sort_container_format_desc()[source]

Tests that the /images registry API returns list of public images sorted alphabetically by container_format in descending order.

test_get_index_sort_created_at_asc()[source]

Tests that the /images registry API returns list of public images sorted by created_at in ascending order.

test_get_index_sort_default_created_at_desc()[source]

Tests that the /images registry API returns list of public images that conforms to a default sort key/dir

test_get_index_sort_disk_format_asc()[source]

Tests that the /images registry API returns list of public images sorted alphabetically by disk_format in ascending order.

test_get_index_sort_name_asc()[source]

Tests that the /images registry API returns list of public images sorted alphabetically by name in ascending order.

test_get_index_sort_size_asc()[source]

Tests that the /images registry API returns list of public images sorted by size in ascending order.

test_get_index_sort_status_desc()[source]

Tests that the /images registry API returns list of public images sorted alphabetically by status in descending order.

test_get_index_sort_updated_at_desc()[source]

Tests that the /images registry API returns list of public images sorted by updated_at in descending order.

test_get_index_unknown_marker()[source]

Tests that the /images registry API returns a 400 when an unknown marker is provided

test_get_member_images()[source]

Tests image listing for members

test_get_on_image_member()[source]

Test GET on image members raises 405 and produces correct Allow headers

test_get_root()[source]

Tests that the root registry API returns “index”, which is a list of public images

test_replace_members()[source]

Tests replacing image members raises right exception

test_show()[source]

Tests that the /images/<id> registry API endpoint returns the expected image

test_show_deleted_image_as_admin()[source]

Tests that the /images/<id> registry API endpoint returns a 200 for deleted image to admin user.

test_show_deleted_image_as_nonadmin()[source]

Tests that the /images/<id> registry API endpoint returns a 404 for deleted image to non-admin user.

test_show_invalid()[source]

Tests that the /images/<id> registry API endpoint returns a 404 for an invalid (therefore unknown) image id

test_show_private_image_with_no_admin_user()[source]
test_show_unknown()[source]

Tests that the /images/<id> registry API endpoint returns a 404 for an unknown image id

test_update_all_image_existing_deleted_members()[source]

Test update existing image members

test_update_all_image_existing_members()[source]

Test update existing image members

test_update_all_image_members()[source]

Test update non existing image members

test_update_all_image_members_bad_request()[source]

Test that right exception is raises in case if wrong memberships association is supplied

test_update_all_image_members_invalid_membership_association()[source]

Test update image members raises right exception

test_update_all_image_members_non_existing_image_id()[source]

Test update image members raises right exception

test_update_all_image_members_non_shared_image_forbidden()[source]

Test update image members raises right exception

test_update_image()[source]

Tests that the /images PUT registry API updates the image

test_update_image_not_existing()[source]

Tests proper exception is raised if attempt to update non-existing image

test_update_image_not_log_sensitive_info(*args, **keywargs)[source]

Tests that there is no any sensitive info of image location was logged in glance during the image update operation.

test_update_image_with_bad_status()[source]

Tests that exception raised trying to set a bad status

test_update_private_image_no_admin()[source]

Tests proper exception is raised if attempt to update private image with non admin user, that not belongs to it

class glance.tests.unit.v1.test_registry_api.TestRegistryAPILocations(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest, glance.tests.utils.RegistryAPIMixIn

setUp()[source]

Establish a clean test environment

tearDown()[source]

Clear the test environment

test_create_from_location_data_with_encryption()[source]
test_show_from_location_data()[source]
test_show_from_locations()[source]
class glance.tests.unit.v1.test_registry_api.TestSharability(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
setup_db()[source]
test_is_image_sharable_as_admin()[source]
test_is_image_sharable_non_owner_as_image_member_without_sharing()[source]
test_is_image_sharable_non_owner_can_share_as_image_member()[source]
test_is_image_sharable_non_owner_cannot_share()[source]
test_is_image_sharable_owner_can_share()[source]
test_is_image_sharable_owner_is_none()[source]

glance.tests.unit.v1.test_registry_client module

class glance.tests.unit.v1.test_registry_client.FakeResponse[source]

Bases: object

getheader(*args, **kwargs)[source]
status = 202
class glance.tests.unit.v1.test_registry_client.TestBaseClient(*args, **kwargs)[source]

Bases: testtools.testcase.TestCase

Test proper actions made for both valid and invalid requests against a Registry service

test_connect_kwargs()[source]
test_connect_kwargs_default_values()[source]
class glance.tests.unit.v1.test_registry_client.TestRegistryV1Client(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest, glance.tests.utils.RegistryAPIMixIn

Test proper actions made for both valid and invalid requests against a Registry service

setUp()[source]

Establish a clean test environment

tearDown()[source]

Clear the test environment

test_add_delete_member()[source]

Tests deleting image members

test_add_image_already_exists()[source]

Tests proper exception is raised if image with ID already exists

test_add_image_basic()[source]

Tests that we can add image metadata and returns the new id

test_add_image_with_bad_status()[source]

Tests proper exception is raised if a bad status is set

test_add_image_with_location_data()[source]

Tests that we can add image metadata with properties

test_add_image_with_location_data_with_encryption()[source]

Tests that we can add image metadata with properties and enable encryption.

test_add_image_with_properties()[source]

Tests that we can add image metadata with properties

test_add_replace_members()[source]

Test replacing image members.

test_create_image_with_null_min_disk_min_ram()[source]
test_delete_image()[source]

Tests that image metadata is deleted properly

test_delete_image_not_existing()[source]

Check that one cannot delete non-existing image.

test_get_image()[source]

Tests that the detailed info about an image returned

test_get_image_details()[source]

Tests that the detailed info about public images returned

test_get_image_details_by_container_format()[source]

Tests that a detailed call can be filtered by container_format

test_get_image_details_by_disk_format()[source]

Tests that a detailed call can be filtered by disk_format

test_get_image_details_by_name()[source]

Tests that a detailed call can be filtered by name

test_get_image_details_by_property()[source]

Tests that a detailed call can be filtered by a property

test_get_image_details_by_status()[source]

Tests that a detailed call can be filtered by status

test_get_image_details_forbidden_marker()[source]

Test exception is raised when marker is forbidden

test_get_image_details_invalid_marker()[source]

Test exception is raised when marker is invalid

test_get_image_details_marker_limit()[source]

Test correct set of images returned with marker/limit params.

test_get_image_details_private_marker()[source]

Test exception is not raised if private non-owned marker is used

test_get_image_details_sort_disk_format_asc()[source]

Tests that a detailed call returns list of public images sorted alphabetically by disk_format in ascending order.

test_get_image_details_with_changes_since()[source]

Tests that a detailed call can be filtered by changes-since

test_get_image_details_with_maximum_size()[source]

Tests that a detailed call can be filtered by size_max

test_get_image_details_with_minimum_size()[source]

Tests that a detailed call can be filtered by size_min

test_get_image_details_with_size_min()[source]

Tests that a detailed call can be filtered by size_min

test_get_image_index()[source]

Test correct set of public image returned

test_get_image_index_by_name()[source]

Test correct set of public, name-filtered image returned. This is just a sanity check, we test the details call more in-depth.

test_get_image_index_forbidden_marker()[source]

Test exception is raised when marker is forbidden

test_get_image_index_invalid_marker()[source]

Test exception is raised when marker is invalid

test_get_image_index_limit()[source]

Test correct number of images returned with limit param.

test_get_image_index_limit_None()[source]

Test correct set of images returned with limit param == None.

test_get_image_index_marker()[source]

Test correct set of images returned with marker param.

test_get_image_index_marker_limit()[source]

Test correct set of images returned with marker/limit params.

test_get_image_index_private_marker()[source]

Test exception is not raised if private non-owned marker is used

test_get_image_is_public_v1()[source]

Tests that a detailed call can be filtered by a property

test_get_image_members()[source]

Test getting image members.

test_get_image_members_not_existing()[source]

Test getting non-existent image members.

test_get_image_non_existing()[source]

Tests that NotFound is raised when getting a non-existing image

test_get_index_sort_container_format_desc()[source]

Tests that the /images registry API returns list of public images sorted alphabetically by container_format in descending order.

test_get_index_sort_created_at_asc()[source]

Tests that the /images registry API returns list of public images sorted by created_at in ascending order.

test_get_index_sort_disk_format_asc()[source]

Tests that the /images registry API returns list of public images sorted alphabetically by disk_format in ascending order.

test_get_index_sort_name_asc()[source]

Tests that the /images registry API returns list of public images sorted alphabetically by name in ascending order.

test_get_index_sort_size_asc()[source]

Tests that the /images registry API returns list of public images sorted by size in ascending order.

test_get_index_sort_status_desc()[source]

Tests that the /images registry API returns list of public images sorted alphabetically by status in descending order.

test_get_index_sort_updated_at_desc()[source]

Tests that the /images registry API returns list of public images sorted by updated_at in descending order.

test_get_member_images()[source]

Test getting member images.

test_update_image()[source]

Tests that the /images PUT registry API updates the image

test_update_image_not_existing()[source]

Tests non existing image update doesn’t work

class glance.tests.unit.v1.test_registry_client.TestRegistryV1ClientApi(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest

setUp()[source]

Establish a clean test environment.

tearDown()[source]

Clear the test environment.

test_configure_registry_admin_creds()[source]
test_configure_registry_admin_creds_with_auth_url()[source]
test_configure_registry_client_not_using_use_user_token()[source]
test_get_registry_client()[source]
test_get_registry_client_with_identity_headers()[source]
class glance.tests.unit.v1.test_registry_client.TestRegistryV1ClientRequests(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest

setUp()[source]
tearDown()[source]
test_do_request()[source]
test_do_request_with_identity_headers()[source]
test_registry_invalid_token_exception_handling()[source]

glance.tests.unit.v1.test_upload_utils module

class glance.tests.unit.v1.test_upload_utils.TestUploadUtils(*args, **kwargs)[source]

Bases: glance.tests.unit.base.StoreClearingUnitTest

setUp()[source]
tearDown()[source]
test_activate_image_with_expired_token(*args, **keywargs)[source]

Test token expiration during image upload.

If users token expired before image was uploaded then if auth error was caught from registry during changing image status from ‘saving’ to ‘active’ then it’s required to delete all image data.

test_initiate_delete()[source]
test_initiate_delete_with_delayed_delete()[source]
test_safe_kill()[source]
test_safe_kill_with_error()[source]
test_upload_data_to_store()[source]
test_upload_data_to_store_client_disconnect()[source]
test_upload_data_to_store_client_disconnect_ioerror()[source]
test_upload_data_to_store_duplicate()[source]

See note in glance.api.v1.upload_utils on why we don’t want image to be deleted in this case.

test_upload_data_to_store_exception()[source]
test_upload_data_to_store_forbidden()[source]
test_upload_data_to_store_http_error()[source]
test_upload_data_to_store_mismatch_checksum()[source]
test_upload_data_to_store_mismatch_size()[source]
test_upload_data_to_store_not_found_after_upload()[source]
test_upload_data_to_store_raises_store_disabled()[source]

Test StoreDisabled exception is raised while uploading data

test_upload_data_to_store_size_limit_exceeded()[source]
test_upload_data_to_store_storage_full()[source]
test_upload_data_to_store_storage_write_denied()[source]
test_upload_data_to_store_user_storage_quota_enabled()[source]

Module contents