glance.tests.unit package

Subpackages

Submodules

glance.tests.unit.base module

class glance.tests.unit.base.IsolatedUnitTest(*args, **kwargs)[source]

Bases: glance.tests.unit.base.StoreClearingUnitTest

Unit test case that establishes a mock environment within a testing directory (in isolation)

registry = None
setUp()[source]
set_policy_rules(rules)[source]
class glance.tests.unit.base.StoreClearingUnitTest(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]

glance.tests.unit.fake_rados module

class glance.tests.unit.fake_rados.mock_rados[source]

Bases: object

class Rados(*args, **kwargs)[source]

Bases: object

connect(*args, **kwargs)[source]
open_ioctx(*args, **kwargs)[source]
shutdown(*args, **kwargs)[source]
class mock_rados.ioctx(*args, **kwargs)[source]

Bases: object

close(*args, **kwargs)[source]
class glance.tests.unit.fake_rados.mock_rbd[source]

Bases: object

class Image(*args, **kwargs)[source]

Bases: object

close()[source]
create_snap(*args, **kwargs)[source]
discard(offset, length)[source]
list_snaps()[source]
parent_info()[source]
protect_snap(*args, **kwargs)[source]
read(*args, **kwargs)[source]
remove_snap(*args, **kwargs)[source]
resize(*args, **kwargs)[source]
size()[source]
unprotect_snap(*args, **kwargs)[source]
write(*args, **kwargs)[source]
exception mock_rbd.ImageBusy[source]

Bases: exceptions.Exception

exception mock_rbd.ImageExists[source]

Bases: exceptions.Exception

exception mock_rbd.ImageNotFound[source]

Bases: exceptions.Exception

class mock_rbd.RBD(*args, **kwargs)[source]

Bases: object

clone(*args, **kwargs)[source]
create(*args, **kwargs)[source]
list(*args, **kwargs)[source]
remove(*args, **kwargs)[source]

glance.tests.unit.test_auth module

class glance.tests.unit.test_auth.FakeResponse(resp)[source]

Bases: object

Simple class that masks the inconsistency between webob.Response.status_int and httplib.Response.status

status
class glance.tests.unit.test_auth.TestEndpoints(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_get_endpoint_raises_with_invalid_endpoint_region()[source]
test_get_endpoint_raises_with_invalid_endpoint_type()[source]
test_get_endpoint_raises_with_invalid_service_type()[source]
test_get_endpoint_with_custom_endpoint_type()[source]
test_get_endpoint_with_custom_server_type()[source]
class glance.tests.unit.test_auth.TestImageFactoryProxy(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_admin_can_set_any_owner()[source]
test_admin_can_set_owner_to_none()[source]
test_admin_still_gets_default_tenant()[source]
test_cannot_set_owner_to_none()[source]
test_default_owner_is_set()[source]
test_wrong_owner_cannot_be_set()[source]
class glance.tests.unit.test_auth.TestImageMutability(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_admin_everything_mutable()[source]
test_no_tenant_nothing_mutable()[source]
test_regular_user()[source]
class glance.tests.unit.test_auth.TestImageRepoProxy(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

class ImageRepoStub(fixtures)[source]

Bases: object

get(image_id)[source]
list(*args, **kwargs)[source]
TestImageRepoProxy.setUp()[source]
TestImageRepoProxy.test_get_immutable_image()[source]
TestImageRepoProxy.test_get_mutable_image()[source]
TestImageRepoProxy.test_list()[source]
class glance.tests.unit.test_auth.TestImmutableImage(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_change_container_format()[source]
test_change_created_at()[source]
test_change_disk_format()[source]
test_change_id()[source]
test_change_locations()[source]
test_change_min_disk()[source]
test_change_min_ram()[source]
test_change_name()[source]
test_change_owner()[source]
test_change_properties()[source]
test_change_size()[source]
test_change_status()[source]
test_change_tags()[source]
test_change_updated_at()[source]
test_change_visibility()[source]
test_deactivate_image()[source]
test_delete()[source]
test_get_data()[source]
test_reactivate_image()[source]
test_set_data()[source]
class glance.tests.unit.test_auth.TestImmutableTask(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_begin_processing()[source]
test_change_created_at()[source]
test_change_expires_at()[source]
test_change_id()[source]
test_change_owner()[source]
test_change_status()[source]
test_change_type()[source]
test_change_updated_at()[source]
test_fail()[source]
test_succeed()[source]
class glance.tests.unit.test_auth.TestImmutableTaskStub(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_change_created_at()[source]
test_change_expires_at()[source]
test_change_id()[source]
test_change_owner()[source]
test_change_status()[source]
test_change_type()[source]
test_change_updated_at()[source]
class glance.tests.unit.test_auth.TestKeystoneAuthPlugin(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

Test that the Keystone auth plugin works properly

setUp()[source]
test_get_plugin_from_strategy_keystone()[source]
test_get_plugin_from_strategy_keystone_configure_via_auth_false()[source]
test_invalid_auth_url_v1()[source]

Test that a 400 during authenticate raises exception.AuthBadRequest

test_invalid_auth_url_v2()[source]

Test that a 400 during authenticate raises exception.AuthBadRequest

test_required_creds()[source]

Test that plugin created without required credential pieces raises an exception

test_v1_auth()[source]

Test v1 auth code paths

test_v2_auth()[source]

Test v2 auth code paths

class glance.tests.unit.test_auth.TestTaskFactoryProxy(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_task_create_admin_context_owner_as_None()[source]
test_task_create_default_owner()[source]
test_task_create_owner_as_None()[source]
test_task_create_wrong_owner()[source]
class glance.tests.unit.test_auth.TestTaskRepoProxy(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

class TaskRepoStub(fixtures)[source]

Bases: object

get(task_id)[source]
class TestTaskRepoProxy.TaskStubRepoStub(fixtures)[source]

Bases: object

list(*args, **kwargs)[source]
TestTaskRepoProxy.setUp()[source]
TestTaskRepoProxy.test_get_immutable_task()[source]
TestTaskRepoProxy.test_get_mutable_task()[source]
TestTaskRepoProxy.test_list()[source]
class glance.tests.unit.test_auth.V2Token[source]

Bases: object

add_service(s_type, region_list=None)[source]
add_service_no_type()[source]
base_endpoint
base_token
token

glance.tests.unit.test_cache_middleware module

class glance.tests.unit.test_cache_middleware.ChecksumTestCacheFilter[source]

Bases: glance.api.middleware.cache.CacheFilter

class glance.tests.unit.test_cache_middleware.FakeImageSerializer[source]

Bases: object

show(response, raw_response)[source]
class glance.tests.unit.test_cache_middleware.ImageStub(image_id, extra_properties=None, visibility='private')[source]

Bases: object

class glance.tests.unit.test_cache_middleware.ProcessRequestTestCacheFilter[source]

Bases: glance.api.middleware.cache.CacheFilter

class glance.tests.unit.test_cache_middleware.TestCacheMiddlewareChecksumVerification(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest

setUp()[source]
test_checksum_missing_header()[source]
test_checksum_v1_header()[source]
test_checksum_v2_header()[source]
class glance.tests.unit.test_cache_middleware.TestCacheMiddlewareProcessRequest(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest

test_process_request_without_download_image_policy()[source]

Test for cache middleware skip processing when request context has not ‘download_image’ role.

test_process_v1_request_for_deleted_but_cached_image()[source]

Test for determining image is deleted from cache when it is not found in Glance Registry.

test_v1_deleted_image_fetch()[source]

Test for determining that when an admin tries to download a deleted image it returns 404 Not Found error.

test_v1_process_request_download_permitted()[source]

Test process_request for v1 api where member role able to download the image with custom property.

test_v1_process_request_download_restricted()[source]

Test process_request for v1 api where _member_ role not able to download the image with custom property.

test_v1_process_request_image_fetch()[source]
test_v1_process_request_image_meta_not_found()[source]

Test process_request for v1 api where registry raises NotFound exception as image metadata not found.

test_v1_remove_location_image_fetch()[source]
test_v2_process_request_download_permitted()[source]

Test process_request for v2 api where member role able to download the image with custom property.

test_v2_process_request_download_restricted()[source]

Test process_request for v2 api where _member_ role not able to download the image with custom property.

test_v2_process_request_response_headers()[source]
test_v2_process_request_without_checksum()[source]
test_verify_metadata_deleted_image()[source]

Test verify_metadata raises exception.NotFound for a deleted image

test_verify_metadata_zero_size()[source]

Test verify_metadata updates metadata with cached image size for images with 0 size

class glance.tests.unit.test_cache_middleware.TestCacheMiddlewareProcessResponse(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest

test_get_status_code()[source]
test_process_response()[source]
test_process_response_without_download_image_policy()[source]

Test for cache middleware raise webob.exc.HTTPForbidden directly when request context has not ‘download_image’ role.

test_process_v1_DELETE_response()[source]
test_v1_process_response_download_permitted()[source]

Test process_response for v1 api where member role able to download the image with custom property.

test_v1_process_response_download_restricted()[source]

Test process_response for v1 api where _member_ role not able to download the image with custom property.

test_v1_process_response_image_meta_not_found()[source]

Test process_response for v1 api where registry raises NotFound exception as image metadata not found.

test_v2_process_response_download_permitted()[source]

Test process_response for v2 api where member role able to download the image with custom property.

test_v2_process_response_download_restricted()[source]

Test process_response for v2 api where _member_ role not able to download the image with custom property.

class glance.tests.unit.test_cache_middleware.TestCacheMiddlewareRequestStashCacheInfo(*args, **kwargs)[source]

Bases: testtools.testcase.TestCase

setUp()[source]
test_fetch_cache_request_info()[source]
test_fetch_cache_request_info_unset()[source]
test_stash_cache_request_info()[source]
class glance.tests.unit.test_cache_middleware.TestCacheMiddlewareURLMatching(*args, **kwargs)[source]

Bases: testtools.testcase.TestCase

test_no_match_unknown_version()[source]
test_v1_match_id_with_query_param()[source]
test_v1_no_match_detail()[source]
test_v1_no_match_detail_with_query_params()[source]
test_v2_match_id()[source]
test_v2_no_match_bad_path()[source]

glance.tests.unit.test_cached_images module

class glance.tests.unit.test_cached_images.FakeCache[source]

Bases: glance.image_cache.ImageCache

delete_all_cached_images()[source]
delete_all_queued_images()[source]
delete_cached_image(image_id)[source]
delete_queued_image(image_id)[source]
get_cached_images()[source]
get_queued_images()[source]
init_driver()[source]
queue_image(image_id)[source]
class glance.tests.unit.test_cached_images.FakeController[source]

Bases: glance.api.cached_images.Controller

class glance.tests.unit.test_cached_images.FakePolicyEnforcer[source]

Bases: glance.api.policy.Enforcer

check(rule, target, creds, exc=None, *args, **kwargs)[source]
enforce(context, action, target)[source]
class glance.tests.unit.test_cached_images.TestCachedImages(*args, **kwargs)[source]

Bases: testtools.testcase.TestCase

setUp()[source]
test_delete_cached_image()[source]
test_delete_cached_images()[source]
test_delete_queued_image()[source]
test_delete_queued_images()[source]
test_get_cached_images()[source]
test_get_queued_images()[source]
test_policy_enforce_forbidden()[source]
test_queue_image()[source]
class glance.tests.unit.test_cached_images.TestController(*args, **kwargs)[source]

Bases: testtools.testcase.TestCase

test_initialization_without_conf()[source]

glance.tests.unit.test_context module

class glance.tests.unit.test_context.TestContext(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

do_visible(exp_res, img_owner, img_public, **kwargs)[source]

Perform a context visibility test. Creates a (fake) image with the specified owner and is_public attributes, then creates a context with the given keyword arguments and expects exp_res as the result of an is_image_visible() call on the context.

setUp()[source]
test_anon_private()[source]

Tests that an anonymous context (with is_admin set to False) can access an unowned image with is_public set to False.

test_anon_private_owned()[source]

Tests that an anonymous context (with is_admin set to False) cannot access an owned image with is_public set to False.

test_anon_public()[source]

Tests that an anonymous context (with is_admin set to False) can access an image with is_public set to True.

test_anon_public_owned()[source]

Tests that an anonymous context (with is_admin set to False) can access an owned image with is_public set to True.

test_auth_private()[source]

Tests that an authenticated context (with is_admin set to False) can access an image with is_public set to False.

test_auth_private_owned()[source]

Tests that an authenticated context (with is_admin set to False) can access an image (which it does own) with is_public set to False.

test_auth_private_unowned()[source]

Tests that an authenticated context (with is_admin set to False) cannot access an image (which it does not own) with is_public set to False.

test_auth_public()[source]

Tests that an authenticated context (with is_admin set to False) can access an image with is_public set to True.

test_auth_public_owned()[source]

Tests that an authenticated context (with is_admin set to False) can access an image (which it does own) with is_public set to True.

test_auth_public_unowned()[source]

Tests that an authenticated context (with is_admin set to False) can access an image (which it does not own) with is_public set to True.

test_empty_private()[source]

Tests that an empty context (with is_admin set to True) can access an image with is_public set to False.

test_empty_private_owned()[source]

Tests that an empty context (with is_admin set to True) can access an owned image with is_public set to False.

test_empty_public()[source]

Tests that an empty context (with is_admin set to True) can access an image with is_public set to True.

test_empty_public_owned()[source]

Tests that an empty context (with is_admin set to True) can access an owned image with is_public set to True.

test_request_id()[source]
test_service_catalog()[source]
test_user_identity()[source]

glance.tests.unit.test_context_middleware module

class glance.tests.unit.test_context_middleware.TestContextMiddleware(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest

test_anonymous_access_defaults_to_disabled()[source]
test_anonymous_access_enabled()[source]
test_header_parsing()[source]
test_invalid_service_catalog()[source]
test_is_admin_flag()[source]
test_response()[source]
test_roles_case_insensitive()[source]
test_roles_stripping()[source]
test_service_catalog()[source]
class glance.tests.unit.test_context_middleware.TestUnauthenticatedContextMiddleware(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest

test_request()[source]
test_response()[source]

glance.tests.unit.test_data_migration_framework module

class glance.tests.unit.test_data_migration_framework.TestDataMigrationFramework(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

test_find_migrations(*args, **keywargs)[source]
test_find_migrations_no_migrations(*args, **keywargs)[source]
test_has_pending_migrations_mult_migration_no_pending(*args, **keywargs)[source]
test_has_pending_migrations_mult_migration_one_pending(*args, **keywargs)[source]
test_has_pending_migrations_mult_migration_some_pending(*args, **keywargs)[source]
test_has_pending_migrations_no_migrations(*args, **keywargs)[source]
test_has_pending_migrations_one_migration_no_pending(*args, **keywargs)[source]
test_has_pending_migrations_one_migration_with_pending(*args, **keywargs)[source]
test_migrate(*args, **keywargs)[source]
test_run_migrations()[source]
test_run_migrations_with_no_migrations()[source]
test_run_migrations_with_one_pending_migration()[source]

glance.tests.unit.test_db module

class glance.tests.unit.test_db.RetryOnDeadlockTestCase(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

test_raise_deadlock()[source]
class glance.tests.unit.test_db.TestDbUtilities(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_get_api_calls_configure_if_present(*args, **keywargs)[source]
test_get_api_skips_configure_if_missing(*args, **keywargs)[source]
class glance.tests.unit.test_db.TestEncryptedLocations(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_decrypt_locations_on_get()[source]
test_decrypt_locations_on_list()[source]
test_encrypt_locations_on_add()[source]
test_encrypt_locations_on_save()[source]
class glance.tests.unit.test_db.TestImageMemberRepo(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_add_duplicate_image_member()[source]
test_add_image_member()[source]
test_get_image_member()[source]
test_get_nonexistent_image_member()[source]
test_list()[source]
test_list_no_members()[source]
test_remove_image_member()[source]
test_remove_image_member_does_not_exist()[source]
test_save_image_member()[source]
class glance.tests.unit.test_db.TestImageRepo(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_add_image()[source]
test_get()[source]
test_get_forbidden()[source]
test_get_not_found()[source]
test_limited_list()[source]
test_list()[source]
test_list_private_images()[source]
test_list_public_images()[source]
test_list_shared_images()[source]
test_list_status()[source]
test_list_status_all()[source]
test_list_status_pending()[source]
test_list_status_rejected()[source]
test_list_with_checksum_filter_multiple_images()[source]
test_list_with_checksum_filter_single_image()[source]
test_list_with_last_marker()[source]
test_list_with_marker()[source]
test_list_with_marker_and_limit()[source]
test_list_with_tags_filter_multiple_tags()[source]
test_list_with_tags_filter_multiple_tags_and_nonexistent()[source]
test_list_with_tags_filter_single_tag()[source]
test_list_with_wrong_checksum()[source]
test_list_with_wrong_tags()[source]
test_location_data_exists()[source]
test_location_data_value()[source]
test_location_value()[source]
test_remove_image()[source]
test_remove_image_not_found()[source]
test_save_image()[source]
test_save_image_not_found()[source]
test_sorted_list()[source]
test_sorted_list_with_multiple_dirs()[source]
test_sorted_list_with_multiple_keys()[source]
class glance.tests.unit.test_db.TestTaskRepo(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_add_task()[source]
test_get()[source]
test_get_forbidden()[source]
test_get_not_found()[source]
test_limited_list()[source]
test_list()[source]
test_list_with_last_marker()[source]
test_list_with_marker()[source]
test_list_with_marker_and_limit()[source]
test_list_with_status()[source]
test_list_with_type()[source]
test_remove_task()[source]
test_save_task()[source]
test_sorted_list()[source]

glance.tests.unit.test_db_metadef module

class glance.tests.unit.test_db_metadef.TestMetadefRepo(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_add_duplicate_tags_with_pre_existing_tags()[source]
test_add_namespace()[source]
test_add_object()[source]
test_add_object_namespace_forbidden()[source]
test_add_object_namespace_not_found()[source]
test_add_property()[source]
test_add_property_namespace_forbidden()[source]
test_add_property_namespace_not_found()[source]
test_add_tag()[source]
test_add_tag_namespace_forbidden()[source]
test_add_tag_namespace_not_found()[source]
test_add_tags()[source]
test_get_namespace()[source]
test_get_namespace_forbidden()[source]
test_get_namespace_not_found()[source]
test_get_object()[source]
test_get_object_not_found()[source]
test_get_property()[source]
test_get_property_not_found()[source]
test_get_tag()[source]
test_get_tag_not_found()[source]
test_list_namespace()[source]
test_list_object()[source]
test_list_object_empty_result()[source]
test_list_object_namespace_not_found()[source]
test_list_private_namespaces()[source]
test_list_property()[source]
test_list_property_empty_result()[source]
test_list_property_namespace_not_found()[source]
test_list_resource_type()[source]
test_list_tag()[source]
test_list_tag_empty_result()[source]
test_list_tag_namespace_not_found()[source]
test_remove_namespace()[source]
test_remove_namespace_not_found()[source]
test_remove_object()[source]
test_remove_object_not_found()[source]
test_remove_property()[source]
test_remove_property_not_found()[source]
test_remove_tag()[source]
test_remove_tag_not_found()[source]
test_save_namespace()[source]
test_save_object()[source]
test_save_property()[source]
test_save_tag()[source]

glance.tests.unit.test_domain module

class glance.tests.unit.test_domain.TestArtifact(**kwargs)[source]

Bases: glance.common.glare.definitions.ArtifactType

created_at = <glance.common.glare.definitions.DateTime object>
deleted_at = <glance.common.glare.definitions.DateTime object>
description = <glance.common.glare.definitions.Text object>
id = <glance.common.glare.definitions.String object>
metadata = <glance.common.glare.declarative.ArtifactTypeMetadata object>
name = <glance.common.glare.definitions.String object>
owner = <glance.common.glare.definitions.String object>
prop1 = {}
prop2 = <glance.common.glare.definitions.Integer object>
published_at = <glance.common.glare.definitions.DateTime object>
state = <glance.common.glare.definitions.String object>
tags = []
type_name = <glance.common.glare.definitions.String object>
type_version = <glance.common.glare.definitions.SemVerString object>
updated_at = <glance.common.glare.definitions.DateTime object>
version = <glance.common.glare.definitions.SemVerString object>
visibility = <glance.common.glare.definitions.String object>
class glance.tests.unit.test_domain.TestArtifactTypeFactory(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_new_artifact_min_params()[source]
class glance.tests.unit.test_domain.TestExtraProperties(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

test_delitem()[source]
test_eq_with_a_dict()[source]
test_eq_with_an_object_of_ExtraProperties()[source]
test_eq_with_incompatible_object()[source]
test_eq_with_uneqal_dict()[source]
test_eq_with_unequal_ExtraProperties_object()[source]
test_getitem()[source]
test_getitem_with_no_items()[source]
test_len_with_non_zero_items()[source]
test_len_with_zero_items()[source]
test_setitem()[source]
class glance.tests.unit.test_domain.TestImage(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_delayed_delete()[source]
test_delete_extra_properties()[source]
test_delete_protected_image()[source]
test_extra_properties()[source]
test_extra_properties_assign()[source]
test_set_incorrect_status()[source]
test_status_active_without_container_format()[source]
test_status_active_without_disk_format()[source]
test_status_saving()[source]
test_status_saving_without_container_format()[source]
test_status_saving_without_disk_format()[source]
test_tags_always_a_set()[source]
test_visibility_enumerated()[source]
class glance.tests.unit.test_domain.TestImageFactory(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_minimal_new_image()[source]
test_new_image()[source]
test_new_image_for_is_public()[source]
test_new_image_read_only_property()[source]
test_new_image_reserved_property()[source]
test_new_image_unexpected_property()[source]
test_new_image_with_extra_properties_and_tags()[source]
class glance.tests.unit.test_domain.TestImageMember(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_status_enumerated()[source]
class glance.tests.unit.test_domain.TestImageMemberFactory(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_minimal_new_image_member()[source]
class glance.tests.unit.test_domain.TestTask(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_begin_processing()[source]
test_fail(*args, **keywargs)[source]
test_invalid_status_transitions_from_failure()[source]
test_invalid_status_transitions_from_pending()[source]
test_invalid_status_transitions_from_success()[source]
test_run(*args, **keywargs)[source]
test_succeed(*args, **keywargs)[source]
test_task_invalid_status()[source]
test_validate_status_transition_from_pending()[source]
test_validate_status_transition_from_processing_to_failure()[source]
test_validate_status_transition_from_processing_to_success()[source]
class glance.tests.unit.test_domain.TestTaskExecutorFactory(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_init()[source]
test_new_task_eventlet_backwards_compatibility()[source]
test_new_task_executor()[source]
test_new_task_executor_error()[source]
class glance.tests.unit.test_domain.TestTaskFactory(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_new_task()[source]
test_new_task_invalid_type()[source]
class glance.tests.unit.test_domain.TestTaskStub(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_task_stub_get_status()[source]
test_task_stub_init()[source]

glance.tests.unit.test_domain_proxy module

class glance.tests.unit.test_domain_proxy.FakeImage(result=None)[source]

Bases: object

class glance.tests.unit.test_domain_proxy.FakeImageFactory(result=None)[source]

Bases: object

new_image(**kwargs)[source]
class glance.tests.unit.test_domain_proxy.FakeImageMembershipFactory(result=None)[source]

Bases: object

new_image_member(image, member_id)[source]
class glance.tests.unit.test_domain_proxy.FakeProxy(base, *args, **kwargs)[source]

Bases: object

class glance.tests.unit.test_domain_proxy.FakeRepo(result=None)[source]

Bases: object

add(*args, **kwargs)
fake_method(*args, **kwargs)[source]
get(*args, **kwargs)
list(*args, **kwargs)
remove(*args, **kwargs)
save(*args, **kwargs)
class glance.tests.unit.test_domain_proxy.TestImageFactory(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_proxy_plain()[source]
test_proxy_wrapping()[source]
class glance.tests.unit.test_domain_proxy.TestImageMembershipFactory(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_proxy_both_wrapped()[source]
test_proxy_plain()[source]
test_proxy_wrapped_image()[source]
test_proxy_wrapped_membership()[source]
class glance.tests.unit.test_domain_proxy.TestProxyRepoPlain(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_add()[source]
test_get()[source]
test_list()[source]
test_remove()[source]
test_save()[source]
class glance.tests.unit.test_domain_proxy.TestProxyRepoWrapping(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_add()[source]
test_add_with_no_result()[source]
test_get()[source]
test_list()[source]
test_remove()[source]
test_remove_with_no_result()[source]
test_save()[source]
test_save_with_no_result()[source]
class glance.tests.unit.test_domain_proxy.TestTaskFactory(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_proxy_plain()[source]
test_proxy_wrapping()[source]

glance.tests.unit.test_glance_manage module

class glance.tests.unit.test_glance_manage.DBCommandsTestCase(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_purge_command(*args, **keywargs)[source]
test_purge_command_exceeded_maximum_rows()[source]
test_purge_command_negative_rows()[source]
test_purge_invalid_age_in_days()[source]
test_purge_invalid_max_rows()[source]
test_purge_max_rows(*args, **keywargs)[source]
test_purge_negative_age_in_days()[source]

glance.tests.unit.test_glance_replicator module

class glance.tests.unit.test_glance_replicator.FakeHTTPConnection[source]

Bases: object

getresponse()[source]
prime_request(method, url, in_body, in_headers, out_code, out_body, out_headers)[source]
request(method, url, body, headers)[source]
class glance.tests.unit.test_glance_replicator.FakeHttpResponse(headers, data)[source]

Bases: object

getheaders()[source]
read(amt=None)[source]
class glance.tests.unit.test_glance_replicator.FakeImageService(http_conn, authtoken)[source]

Bases: object

add_image(meta, data)[source]
add_image_meta(meta)[source]
get_image(id)[source]
get_image_meta(id)[source]
get_images()[source]
class glance.tests.unit.test_glance_replicator.ImageServiceTestCase(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

test_rest_add_image()[source]
test_rest_add_image_meta()[source]
test_rest_dict_to_headers()[source]
test_rest_errors()[source]
test_rest_get_image()[source]
test_rest_get_image_meta()[source]
test_rest_get_images()[source]
test_rest_header_list_to_dict()[source]
class glance.tests.unit.test_glance_replicator.ReplicationCommandsTestCase(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

test_help(*args, **keywargs)[source]
test_human_readable_size()[source]
test_replication_compare()[source]
test_replication_compare_with_bad_args()[source]
test_replication_compare_with_no_args()[source]
test_replication_dump()[source]
test_replication_dump_with_bad_args()[source]
test_replication_dump_with_no_args()[source]
test_replication_livecopy()[source]
test_replication_livecopy_with_bad_args()[source]
test_replication_livecopy_with_no_args()[source]
test_replication_load()[source]
test_replication_load_with_bad_args()[source]
test_replication_load_with_no_args()[source]
test_replication_size()[source]
test_replication_size_with_args_is_None()[source]
test_replication_size_with_bad_args()[source]
test_replication_size_with_no_args()[source]
class glance.tests.unit.test_glance_replicator.ReplicationUtilitiesTestCase(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

test_check_upload_response_headers()[source]
test_dict_diff()[source]
test_image_present()[source]
glance.tests.unit.test_glance_replicator.check_bad_args(command, args)[source]
glance.tests.unit.test_glance_replicator.check_no_args(command, args)[source]
glance.tests.unit.test_glance_replicator.get_image_service()[source]

glance.tests.unit.test_glare_plugin_loader module

class glance.tests.unit.test_glare_plugin_loader.MyArtifactDuplicate(**kwargs)[source]

Bases: glance.contrib.plugins.artifacts_sample.v1.artifact.MyArtifact

created_at = <glance.common.glare.definitions.DateTime object>
deleted_at = <glance.common.glare.definitions.DateTime object>
depends_on = <glance.common.glare.definitions.ArtifactReference object>
description = <glance.common.glare.definitions.Text object>
id = <glance.common.glare.definitions.String object>
image_file = <glance.common.glare.definitions.BinaryObject object>
int_list = []
metadata = <glance.common.glare.declarative.ArtifactTypeMetadata object>
name = <glance.common.glare.definitions.String object>
owner = <glance.common.glare.definitions.String object>
prop1 = <glance.common.glare.definitions.String object>
prop2 = <glance.common.glare.definitions.Integer object>
published_at = <glance.common.glare.definitions.DateTime object>
references = []
screenshots = []
state = <glance.common.glare.definitions.String object>
tags = []
type_name = <glance.common.glare.definitions.String object>
type_version = <glance.common.glare.definitions.SemVerString object>
updated_at = <glance.common.glare.definitions.DateTime object>
version = <glance.common.glare.definitions.SemVerString object>
visibility = <glance.common.glare.definitions.String object>
class glance.tests.unit.test_glare_plugin_loader.MyArtifactOk(**kwargs)[source]

Bases: glance.contrib.plugins.artifacts_sample.v1.artifact.MyArtifact

created_at = <glance.common.glare.definitions.DateTime object>
deleted_at = <glance.common.glare.definitions.DateTime object>
depends_on = <glance.common.glare.definitions.ArtifactReference object>
description = <glance.common.glare.definitions.Text object>
id = <glance.common.glare.definitions.String object>
image_file = <glance.common.glare.definitions.BinaryObject object>
int_list = []
metadata = <glance.common.glare.declarative.ArtifactTypeMetadata object>
name = <glance.common.glare.definitions.String object>
owner = <glance.common.glare.definitions.String object>
prop1 = <glance.common.glare.definitions.String object>
prop2 = <glance.common.glare.definitions.Integer object>
published_at = <glance.common.glare.definitions.DateTime object>
references = []
screenshots = []
state = <glance.common.glare.definitions.String object>
tags = []
type_name = <glance.common.glare.definitions.String object>
type_version = <glance.common.glare.definitions.SemVerString object>
updated_at = <glance.common.glare.definitions.DateTime object>
version = <glance.common.glare.definitions.SemVerString object>
visibility = <glance.common.glare.definitions.String object>
class glance.tests.unit.test_glare_plugin_loader.TestArtifactsLoader(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_basic_loader_func()[source]

Test public methods of PluginLoader class here

test_check_function()[source]

A test to show that plugin-load specific options in artifacts.conf are correctly processed:

  • no plugins can be loaded if load_enabled = False
  • if available_plugins list is given only plugins specified can be be loaded
test_config_validation()[source]
Plugins can be loaded on certain conditions:
  • entry point name == type_name
  • no plugin with the same type_name and version has been already loaded
test_load()[source]

Plugins can be loaded as entrypoint=single plugin and entrypoint=[a, list, of, plugins]

glance.tests.unit.test_glare_type_definition_framework module

class glance.tests.unit.test_glare_type_definition_framework.SerTestType(**kwargs)[source]

Bases: glance.common.glare.definitions.ArtifactType

another_array = []
another_dict = {}
created_at = <glance.common.glare.definitions.DateTime object>
deleted_at = <glance.common.glare.definitions.DateTime object>
description = <glance.common.glare.definitions.Text object>
id = <glance.common.glare.definitions.String object>
metadata = <glance.common.glare.declarative.ArtifactTypeMetadata object>
name = <glance.common.glare.definitions.String object>
owner = <glance.common.glare.definitions.String object>
published_at = <glance.common.glare.definitions.DateTime object>
some_array = []
some_blob = <glance.common.glare.definitions.BinaryObject object>
some_blob_list = []
some_bool = <glance.common.glare.definitions.Boolean object>
some_dict = {}
some_int = <glance.common.glare.definitions.Integer object>
some_numeric = <glance.common.glare.definitions.Numeric object>
some_ref = <glance.common.glare.definitions.ArtifactReference object>
some_ref_list = []
some_string = <glance.common.glare.definitions.String object>
some_text = <glance.common.glare.definitions.Text object>
some_version = <glance.common.glare.definitions.SemVerString object>
state = <glance.common.glare.definitions.String object>
tags = []
type_name = <glance.common.glare.definitions.String object>
type_version = <glance.common.glare.definitions.SemVerString object>
updated_at = <glance.common.glare.definitions.DateTime object>
version = <glance.common.glare.definitions.SemVerString object>
visibility = <glance.common.glare.definitions.String object>
class glance.tests.unit.test_glare_type_definition_framework.TestArtifactType(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

test_blob()[source]
test_create_artifact()[source]
test_default_value_of_immutable_field_in_active_state()[source]
test_dependency_list()[source]
test_dependency_prop()[source]
test_pre_publish_blob_validation()[source]
test_pre_publish_dependency_validation()[source]
class glance.tests.unit.test_glare_type_definition_framework.TestDeclarativeProperties(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

test_artifact_type_properties()[source]
test_base_declarative_attributes()[source]
test_binary_object_mutable()[source]
test_composite_dict()[source]
test_default_and_allowed_violates_int_constrains()[source]
test_default_and_allowed_violates_numeric_constrains()[source]
test_default_and_allowed_violates_string_constrains()[source]
test_default_violates_allowed()[source]
test_generic_property()[source]
test_immutables()[source]
test_integer_property()[source]
test_mutable_array_dict()[source]
test_numeric_values()[source]
test_readonly_array_dict()[source]
test_readonly_as_write_once()[source]
test_same_item_type_array()[source]
test_same_item_type_dict()[source]
test_string_property()[source]
test_tuple_style_array()[source]
test_wrong_type_definition()[source]
class glance.tests.unit.test_glare_type_definition_framework.TestSerialization(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

test_deserialize_from_db()[source]
test_serialization_to_db()[source]
glance.tests.unit.test_glare_type_definition_framework.get_artifact_fixture(**kwargs)[source]

glance.tests.unit.test_image_cache module

class glance.tests.unit.test_image_cache.ImageCacheTestCase[source]

Bases: object

test_caching_iterator()[source]

Test to see if the caching iterator interacts properly with the driver When the iterator completes going through the data the driver should have closed the image and placed it correctly

test_caching_iterator_falloffend()[source]

Test to see if the caching iterator interacts properly with the driver in a case where the iterator is only partially consumed. In this case the image is only partially filled in cache and filling wont resume. When the iterator goes out of scope the driver should have closed the image and moved it from incomplete/ to invalid/

test_caching_iterator_handles_backend_failure()[source]

Test that when the backend fails, caching_iter does not continue trying to consume data, and rolls back the cache.

test_clean_stalled(*a, **kwargs)[source]

Test the clean method removes expected images.

test_clean_stalled_nonzero_stall_time(*a, **kwargs)[source]

Test the clean method removes the stalled images as expected

test_delete(*a, **kwargs)[source]

Test delete method that removes an image from the cache.

test_delete_all(*a, **kwargs)[source]

Test delete method that removes an image from the cache.

test_gate_caching_iter_bad_checksum()[source]
test_gate_caching_iter_good_checksum()[source]
test_get_image_size(*a, **kwargs)[source]

Test convenience wrapper for querying cache file size via its image identifier.

test_is_cached(*a, **kwargs)[source]

Verify is_cached(1) returns 0, then add something to the cache and verify is_cached(1) returns 1.

test_open_for_read(*a, **kwargs)[source]

Test convenience wrapper for opening a cache file via its image identifier.

test_open_for_write_good()[source]

Test to see if open_for_write works in normal case

test_open_for_write_with_exception()[source]

Test to see if open_for_write works in a failure case for each driver This case is where an exception is raised while the file is being written. The image is partially filled in cache and filling wont resume so verify the image is moved to invalid/ directory

test_prune(*a, **kwargs)[source]

Test that pruning the cache works as expected...

test_prune_to_zero(*a, **kwargs)[source]

Test that an image_cache_max_size of 0 doesn’t kill the pruner

This is a test specifically for LP #1039854

test_queue(*a, **kwargs)[source]

Test that queueing works properly

test_read(*a, **kwargs)[source]

Verify is_cached(1) returns 0, then add something to the cache and verify after a subsequent read from the cache that is_cached(1) returns 1.

class glance.tests.unit.test_image_cache.TestImageCacheNoDep(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_get_caching_iter_when_open_fails()[source]
test_get_caching_iter_when_write_fails()[source]
class glance.tests.unit.test_image_cache.TestImageCacheSqlite(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase, glance.tests.unit.test_image_cache.ImageCacheTestCase

Tests image caching when SQLite is used in cache

setUp()[source]

Test to see if the pre-requisites for the image cache are working (python-sqlite3 installed)

class glance.tests.unit.test_image_cache.TestImageCacheXattr(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase, glance.tests.unit.test_image_cache.ImageCacheTestCase

Tests image caching when xattr is used in cache

setUp()[source]

Test to see if the pre-requisites for the image cache are working (python-xattr installed and xattr support on the filesystem)

glance.tests.unit.test_image_cache_client module

class glance.tests.unit.test_image_cache_client.CacheClientTestCase(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_delete_all_cached_images()[source]
test_delete_all_queued_images()[source]
test_delete_cached_image()[source]
test_delete_queued_image()[source]
test_get_cached_images()[source]
test_get_queued_images()[source]
test_queue_image_for_caching()[source]
class glance.tests.unit.test_image_cache_client.GetClientTestCase(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
tearDown()[source]
test_get_client_all_creds()[source]
test_get_client_client_configuration_error()[source]
test_get_client_host_only()[source]
test_get_client_using_provided_host()[source]

glance.tests.unit.test_jsonpatchmixin module

class glance.tests.unit.test_jsonpatchmixin.TestJsonPatchMixin(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

test_body_validation()[source]
test_op_validation()[source]
test_path_validation()[source]
test_value_validation()[source]
class glance.tests.unit.test_jsonpatchmixin.TestValidator(methods_allowed=None)[source]

Bases: glance.common.jsonpatchvalidator.JsonPatchValidatorMixin

glance.tests.unit.test_manage module

class glance.tests.unit.test_manage.TestLegacyManage(*args, **kwargs)[source]

Bases: glance.tests.unit.test_manage.TestManageBase

test_db_metadefs_export()[source]
test_db_metadefs_export_with_specified_path()[source]
test_db_metadefs_load()[source]
test_db_metadefs_load_from_merge_and_prefer_new()[source]
test_db_metadefs_load_from_merge_and_prefer_new_and_overwrite()[source]
test_db_metadefs_load_from_path_merge()[source]
test_db_metadefs_load_with_specified_path()[source]
test_db_metadefs_unload()[source]
test_legacy_db_contract(*args, **keywargs)[source]
test_legacy_db_expand(*args, **keywargs)[source]
test_legacy_db_migrate(*args, **keywargs)[source]
test_legacy_db_sync(*args, **keywargs)[source]
test_legacy_db_sync_version(*args, **keywargs)[source]
test_legacy_db_upgrade(*args, **keywargs)[source]
test_legacy_db_upgrade_version(*args, **keywargs)[source]
test_legacy_db_version(*args, **keywargs)[source]
test_legacy_db_version_control(*args, **keywargs)[source]
class glance.tests.unit.test_manage.TestManage(*args, **kwargs)[source]

Bases: glance.tests.unit.test_manage.TestManageBase

test_db_contract(*args, **keywargs)[source]
test_db_expand(*args, **keywargs)[source]
test_db_metadefs_export()[source]
test_db_metadefs_export_with_specified_path()[source]
test_db_metadefs_load()[source]
test_db_metadefs_load_from_path_overwrite_existing()[source]
test_db_metadefs_load_overwrite_existing()[source]
test_db_metadefs_load_prefer_new()[source]
test_db_metadefs_load_prefer_new_and_overwrite_existing()[source]
test_db_metadefs_load_prefer_new_with_path()[source]
test_db_metadefs_load_with_specified_path()[source]
test_db_metadefs_unload()[source]
test_db_migrate(*args, **keywargs)[source]
test_db_sync(*args, **keywargs)[source]
test_db_sync_version(*args, **keywargs)[source]
test_db_upgrade(*args, **keywargs)[source]
test_db_upgrade_version(*args, **keywargs)[source]
test_db_version(*args, **keywargs)[source]
test_db_version_control(*args, **keywargs)[source]
class glance.tests.unit.test_manage.TestManageBase(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]

glance.tests.unit.test_misc module

class glance.tests.unit.test_misc.UtilsTestCase(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

test_empty_metadata_headers()[source]

Ensure unset metadata is not encoded in HTTP headers

test_encryption()[source]

glance.tests.unit.test_notifier module

class glance.tests.unit.test_notifier.ImageMemberRepoStub[source]

Bases: object

add(*args, **kwargs)[source]
get(*args, **kwargs)[source]
list(*args, **kwargs)[source]
remove(*args, **kwargs)[source]
save(*args, **kwargs)[source]
class glance.tests.unit.test_notifier.ImageRepoStub[source]

Bases: object

add(*args, **kwargs)[source]
get(*args, **kwargs)[source]
list(*args, **kwargs)[source]
remove(*args, **kwargs)[source]
save(*args, **kwargs)[source]
class glance.tests.unit.test_notifier.ImageStub(image_id, status, created_at, updated_at, **kwargs)[source]

Bases: glance.domain.Image

get_data(offset=0, chunk_size=None)[source]
set_data(data, size=None)[source]
class glance.tests.unit.test_notifier.Task(task_id, task_type, status, owner, expires_at, created_at, updated_at, task_input, result, message)[source]

Bases: glance.domain.Task

fail(message)[source]
succeed(result)[source]
class glance.tests.unit.test_notifier.TaskRepoStub[source]

Bases: object

add(*args, **kwargs)[source]
get_task(*args, **kwargs)[source]
list(*args, **kwargs)[source]
remove(*args, **kwargs)[source]
save(*args, **kwargs)[source]
class glance.tests.unit.test_notifier.TaskStub(task_id, task_type, status, owner, expires_at, created_at, updated_at)[source]

Bases: glance.domain.TaskStub

run(executor)[source]
class glance.tests.unit.test_notifier.TestImageMemberNotifications(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

Test Image Member Notifications work

setUp()[source]
test_image_member_add_notification()[source]
test_image_member_add_notification_disabled()[source]
test_image_member_delete_notification()[source]
test_image_member_delete_notification_disabled()[source]
test_image_member_get()[source]
test_image_member_list()[source]
test_image_member_save_notification()[source]
test_image_member_save_notification_disabled()[source]
class glance.tests.unit.test_notifier.TestImageNotifications(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

Test Image Notifications work

setUp()[source]
test_image_add_notification()[source]
test_image_add_notification_disabled()[source]
test_image_delete_notification()[source]
test_image_delete_notification_disabled()[source]
test_image_get()[source]
test_image_get_data_notification()[source]
test_image_get_data_notification_disabled()[source]
test_image_get_data_should_call_next_image_get_data()[source]
test_image_get_data_size_mismatch()[source]
test_image_list()[source]
test_image_save_notification()[source]
test_image_save_notification_disabled()[source]
test_image_set_data_HTTP_error()[source]
test_image_set_data_duplicate()[source]
test_image_set_data_error()[source]
test_image_set_data_forbidden()[source]
test_image_set_data_not_found()[source]
test_image_set_data_prepare_notification()[source]
test_image_set_data_prepare_notification_disabled()[source]
test_image_set_data_storage_full()[source]
test_image_set_data_storage_write_denied()[source]
test_image_set_data_upload_and_activate_notification()[source]
test_image_set_data_upload_and_activate_notification_disabled()[source]
test_image_set_data_value_error()[source]
class glance.tests.unit.test_notifier.TestNotifier(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

test_notifier_load()[source]
test_set_defaults(*args, **keywargs)[source]
class glance.tests.unit.test_notifier.TestTaskNotifications(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

Test Task Notifications work

setUp()[source]
tearDown()[source]
test_task_create_notification()[source]
test_task_create_notification_disabled()[source]
test_task_delete_notification()[source]
test_task_delete_notification_disabled()[source]
test_task_failure_notification()[source]
test_task_failure_notification_disabled()[source]
test_task_processing_notification()[source]
test_task_processing_notification_disabled()[source]
test_task_run_notification()[source]
test_task_run_notification_disabled()[source]
test_task_success_notification()[source]
test_task_success_notification_disabled()[source]

glance.tests.unit.test_policy module

class glance.tests.unit.test_policy.ImageFactoryStub[source]

Bases: object

new_image(image_id=None, name=None, visibility='private', min_disk=0, min_ram=0, protected=False, owner=None, disk_format=None, container_format=None, extra_properties=None, tags=None, **other_args)[source]
class glance.tests.unit.test_policy.ImageMembershipStub(output=None)[source]

Bases: object

class glance.tests.unit.test_policy.ImageRepoStub[source]

Bases: object

add(*args, **kwargs)[source]
get(*args, **kwargs)[source]
list(*args, **kwargs)[source]
save(*args, **kwargs)[source]
class glance.tests.unit.test_policy.ImageStub(image_id=None, visibility='private', container_format='bear', disk_format='raw', status='active', extra_properties=None)[source]

Bases: object

delete()[source]
class glance.tests.unit.test_policy.IterableMock(spec=None, side_effect=None, return_value=sentinel.DEFAULT, wraps=None, name=None, spec_set=None, parent=None, _spec_state=None, _new_name='', _new_parent=None, **kwargs)[source]

Bases: mock.mock.Mock, _abcoll.Iterable

class glance.tests.unit.test_policy.MemberRepoStub[source]

Bases: object

add(image_member)[source]
get(*args, **kwargs)[source]
image = None
list(*args, **kwargs)[source]
remove(image_member)[source]
save(image_member, from_state=None)[source]
class glance.tests.unit.test_policy.TaskFactoryStub[source]

Bases: object

new_task(*args)[source]
class glance.tests.unit.test_policy.TaskRepoStub[source]

Bases: object

add(*args, **kwargs)[source]
get(*args, **kwargs)[source]
list(*args, **kwargs)[source]
class glance.tests.unit.test_policy.TaskStub(task_id)[source]

Bases: object

run(executor)[source]
class glance.tests.unit.test_policy.TestContextPolicyEnforcer(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest

test_context_admin_policy_admin()[source]
test_context_admin_policy_nonadmin()[source]
test_context_nonadmin_policy_admin()[source]
test_context_nonadmin_policy_nonadmin()[source]
class glance.tests.unit.test_policy.TestImagePolicy(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_add_image_allowed()[source]
test_add_image_not_allowed()[source]
test_communitize_image_allowed()[source]
test_communitize_image_not_allowed()[source]
test_delete_image_allowed()[source]
test_delete_image_not_allowed()[source]
test_get_image_allowed()[source]
test_get_image_not_allowed()[source]
test_get_images_allowed()[source]
test_get_images_not_allowed()[source]
test_image_get_data_policy_enforced_with_target()[source]
test_image_set_data()[source]
test_modify_image_allowed()[source]
test_modify_image_not_allowed()[source]
test_new_image_visibility_community_allowed()[source]
test_new_image_visibility_community_not_allowed()[source]
test_new_image_visibility_public_allowed()[source]
test_new_image_visibility_public_not_allowed()[source]
test_publicize_image_allowed()[source]
test_publicize_image_not_allowed()[source]
class glance.tests.unit.test_policy.TestMemberPolicy(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_add_member_allowed()[source]
test_add_member_not_allowed()[source]
test_delete_member_allowed()[source]
test_delete_member_not_allowed()[source]
test_get_member_allowed()[source]
test_get_member_not_allowed()[source]
test_get_members_allowed()[source]
test_get_members_not_allowed()[source]
test_modify_member_allowed()[source]
test_modify_member_not_allowed()[source]
class glance.tests.unit.test_policy.TestPolicyEnforcer(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest

test_policy_file_check()[source]
test_policy_file_custom_location()[source]
test_policy_file_custom_rules_default_location()[source]
test_policy_file_default_rules_default_location()[source]
test_policy_file_get_image_default_everybody()[source]
test_policy_file_get_image_default_nobody()[source]
class glance.tests.unit.test_policy.TestPolicyEnforcerNoFile(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest

test_policy_file_default_not_found()[source]

Missing default policy file should result in a default ruleset

test_policy_file_specified_but_not_found()[source]

Missing defined policy file should result in a default ruleset

class glance.tests.unit.test_policy.TestTaskPolicy(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_add_task_allowed()[source]
test_add_task_not_allowed()[source]
test_get_task_allowed()[source]
test_get_task_not_allowed()[source]
test_get_tasks_allowed()[source]
test_get_tasks_not_allowed()[source]

glance.tests.unit.test_quota module

class glance.tests.unit.test_quota.FakeContext[source]

Bases: object

is_admin = False
owner = 'someone'
class glance.tests.unit.test_quota.FakeImage(**kwargs)[source]

Bases: object

image_id = 'someid'
locations = [{'url': 'file:///not/a/path', 'metadata': {}}]
set_data(data, size=None)[source]
size = None
tags = set([])
class glance.tests.unit.test_quota.TestImageLocationQuotas(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_add_image_location()[source]
test_add_too_many_image_locations()[source]
test_add_unlimited_image_locations()[source]
test_remove_image_location_while_over_quota()[source]
test_replace_image_location()[source]
test_replace_too_many_image_locations()[source]
test_replace_unlimited_image_locations()[source]
class glance.tests.unit.test_quota.TestImageMemberQuotas(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_new_image_member()[source]
test_new_image_member_too_many_members()[source]
test_new_image_member_unlimited_members()[source]
class glance.tests.unit.test_quota.TestImagePropertyQuotas(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_add_image_too_many_image_properties()[source]
test_add_image_unlimited_image_properties()[source]
test_add_image_with_image_property()[source]
test_delete_image_properties_when_quota_exceeded()[source]
test_exceed_quota_during_patch_operation()[source]
test_invalid_quota_config_parameter()[source]
test_modify_image_properties_when_quota_exceeded()[source]
test_quota_exceeded_after_delete_image_properties()[source]
test_save_image_too_many_image_properties()[source]
test_save_image_unlimited_image_properties()[source]
test_save_image_with_image_property()[source]
class glance.tests.unit.test_quota.TestImageQuota(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
tearDown()[source]
test_append_location()[source]
test_append_location_for_queued_image()[source]
test_exceed_append_location()[source]
test_exceed_extend_location()[source]
test_exceed_insert_location()[source]
test_extend_location()[source]
test_iadd_location()[source]
test_iadd_location_exceed()[source]
test_iadd_location_for_queued_image()[source]
test_insert_location()[source]
test_insert_location_for_queued_image()[source]
test_quota_allowed()[source]
test_quota_allowed_unit_b()[source]
test_quota_allowed_unit_gb()[source]
test_quota_allowed_unit_kb()[source]
test_quota_allowed_unit_mb()[source]
test_quota_allowed_unit_tb()[source]
test_quota_exceeded_no_size()[source]
test_quota_exceeded_with_lie_size()[source]
test_quota_exceeded_with_right_size()[source]
test_quota_exceeded_with_right_size_b()[source]
test_quota_exceeded_with_right_size_kb()[source]
test_set_location()[source]
test_set_location_exceed()[source]
test_set_location_for_queued_image()[source]
test_set_location_under()[source]
class glance.tests.unit.test_quota.TestImageTagQuotas(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_add_image_tag()[source]
test_add_too_many_image_tags()[source]
test_add_unlimited_image_tags()[source]
test_remove_image_tag_while_over_quota()[source]
test_replace_image_tag()[source]
test_replace_too_many_image_tags()[source]
test_replace_unlimited_image_tags()[source]
class glance.tests.unit.test_quota.TestQuotaImageTagsProxy(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_add()[source]
test_add_too_many_tags()[source]
test_contains()[source]
test_equals()[source]
test_iter()[source]
test_len()[source]
test_not_equals()[source]

glance.tests.unit.test_schema module

class glance.tests.unit.test_schema.TestBasicSchema(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_filter_strips_extra_properties()[source]
test_merge_conflicting_but_identical_properties()[source]
test_merge_conflicting_properties()[source]
test_merge_properties()[source]
test_raw_json_schema()[source]
test_validate_fails_on_bad_type()[source]
test_validate_fails_on_extra_properties()[source]
test_validate_passes()[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_raw_json_schema()[source]
class glance.tests.unit.test_schema.TestCollectionSchema(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

test_raw_json_schema()[source]
class glance.tests.unit.test_schema.TestPermissiveSchema(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_filter_passes_extra_properties()[source]
test_raw_json_schema()[source]
test_validate_rejects_non_string_extra_properties()[source]
test_validate_with_additional_properties_allowed()[source]

glance.tests.unit.test_scrubber module

class glance.tests.unit.test_scrubber.ImagePager(images, page_size=0)[source]

Bases: object

class glance.tests.unit.test_scrubber.TestScrubDBQueue(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
tearDown()[source]
test_get_all_images()[source]
test_get_all_images_paged()[source]
class glance.tests.unit.test_scrubber.TestScrubber(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
tearDown()[source]
test_store_delete_notfound_exception()[source]
test_store_delete_store_exceptions()[source]
test_store_delete_successful()[source]

glance.tests.unit.test_store_glare module

class glance.tests.unit.test_store_glare.ArtifactStub(**kwargs)[source]

Bases: glance.common.glare.definitions.ArtifactType

created_at = <glance.common.glare.definitions.DateTime object>
deleted_at = <glance.common.glare.definitions.DateTime object>
description = <glance.common.glare.definitions.Text object>
file = <glance.common.glare.definitions.BinaryObject object>
file_list = []
id = <glance.common.glare.definitions.String object>
metadata = <glance.common.glare.declarative.ArtifactTypeMetadata object>
name = <glance.common.glare.definitions.String object>
owner = <glance.common.glare.definitions.String object>
published_at = <glance.common.glare.definitions.DateTime object>
state = <glance.common.glare.definitions.String object>
tags = []
type_name = <glance.common.glare.definitions.String object>
type_version = <glance.common.glare.definitions.SemVerString object>
updated_at = <glance.common.glare.definitions.DateTime object>
version = <glance.common.glare.definitions.SemVerString object>
visibility = <glance.common.glare.definitions.String object>
class glance.tests.unit.test_store_glare.TestStoreArtifact(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_set_blob_data()[source]
test_set_bloblist_data()[source]

glance.tests.unit.test_store_image module

class glance.tests.unit.test_store_image.FakeMemberRepo(image, tenants=None)[source]

Bases: object

add(member)[source]
list(*args, **kwargs)[source]
remove(member)[source]
class glance.tests.unit.test_store_image.ImageFactoryStub[source]

Bases: object

new_image(image_id=None, name=None, visibility='private', min_disk=0, min_ram=0, protected=False, owner=None, disk_format=None, container_format=None, extra_properties=None, tags=None, **other_args)[source]
class glance.tests.unit.test_store_image.ImageRepoStub[source]

Bases: object

add(image)[source]
save(image, from_state=None)[source]
class glance.tests.unit.test_store_image.ImageStub(image_id, status=None, locations=None, visibility=None, extra_properties=None)[source]

Bases: object

delete()[source]
get_member_repo()[source]
class glance.tests.unit.test_store_image.TestImageFactory(*args, **kwargs)[source]

Bases: glance.tests.unit.base.StoreClearingUnitTest

setUp()[source]
test_new_image()[source]
test_new_image_with_location()[source]
class glance.tests.unit.test_store_image.TestStoreImage(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

setUp()[source]
test_image_change_adding_invalid_location_metadata()[source]
test_image_change_adding_invalid_location_uri()[source]
test_image_change_adding_locations()[source]
test_image_change_append_invalid_location_metatdata()[source]
test_image_change_append_invalid_location_uri()[source]
test_image_change_append_locations()[source]
test_image_change_delete_location()[source]
test_image_change_delete_locations()[source]
test_image_change_extend_invalid_locations_metadata()[source]
test_image_change_extend_invalid_locations_uri()[source]
test_image_change_extend_locations()[source]
test_image_change_insert_invalid_location_metadata()[source]
test_image_change_insert_invalid_location_uri()[source]
test_image_change_insert_location()[source]
test_image_change_pop_location()[source]
test_image_change_remove_location()[source]
test_image_checking_location_exists()[source]
test_image_delete()[source]
test_image_get_data()[source]
test_image_get_data_from_second_location()[source]
test_image_get_location_by_index()[source]
test_image_get_location_index()[source]
test_image_reverse_locations_order()[source]
test_image_set_data()[source]
test_image_set_data_invalid_signature()[source]
test_image_set_data_invalid_signature_missing_metadata()[source]
test_image_set_data_location_metadata()[source]
test_image_set_data_unknown_size()[source]
test_image_set_data_valid_signature(*args, **keywargs)[source]
class glance.tests.unit.test_store_image.TestStoreImageRepo(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

get_fake_member_repo(image, context, db_api, store_api)[source]
setUp()[source]
test_add_fetches_members_if_private()[source]
test_add_ignores_acls_if_no_locations()[source]
test_add_updates_acls()[source]
test_member_addition_updates_acls()[source]
test_member_removal_updates_acls()[source]
test_save_fetches_members_if_private()[source]
test_save_updates_acls()[source]
class glance.tests.unit.test_store_image.TestStoreMetaDataChecker(*args, **kwargs)[source]

Bases: glance.tests.utils.BaseTestCase

test_empty()[source]
test_list_bad()[source]
test_nested_dict()[source]
test_nested_dict_bad()[source]
test_simple_bad()[source]
test_unicode()[source]
test_unicode_dict()[source]
test_unicode_dict_list()[source]
test_unicode_list()[source]

glance.tests.unit.test_store_location module

class glance.tests.unit.test_store_location.TestStoreLocation(*args, **kwargs)[source]

Bases: glance.tests.unit.base.StoreClearingUnitTest

class FakeImageProxy[source]

Bases: object

context = None
size = None
store_api = <Mock id='140642323202256'>
store_utils = <module 'glance.common.store_utils' from '/home/zuul/src/opendev.org/openstack/glance/glance/common/store_utils.py'>
TestStoreLocation.test_add_location_for_image_without_size()[source]
TestStoreLocation.test_add_location_with_restricted_sources()[source]

glance.tests.unit.test_versions module

class glance.tests.unit.test_versions.VersionNegotiationTest(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest

setUp()[source]
test_request_accept_v1()[source]
test_request_url_v1()[source]
test_request_url_v1_0()[source]
test_request_url_v1_1()[source]
test_request_url_v2()[source]
test_request_url_v2_0()[source]
test_request_url_v2_1()[source]
test_request_url_v2_2()[source]
test_request_url_v2_3()[source]
test_request_url_v2_4()[source]
test_request_url_v2_5()[source]
test_request_url_v2_6_unsupported()[source]
test_request_url_v4_unsupported()[source]
class glance.tests.unit.test_versions.VersionsAndNegotiationTest(*args, **kwargs)[source]

Bases: glance.tests.unit.test_versions.VersionNegotiationTest, glance.tests.unit.test_versions.VersionsTest

Test that versions mentioned in the versions response are correctly negotiated.

test_current_is_negotiated()[source]
test_deprecated_is_negotiated()[source]
test_supported_is_negotiated()[source]
class glance.tests.unit.test_versions.VersionsTest(*args, **kwargs)[source]

Bases: glance.tests.unit.base.IsolatedUnitTest

Test the version information returned from the API service.

test_get_version_list()[source]
test_get_version_list_public_endpoint()[source]
test_get_version_list_secure_proxy_ssl_header()[source]
test_get_version_list_secure_proxy_ssl_header_https()[source]

glance.tests.unit.utils module

class glance.tests.unit.utils.FakeDB(initialize=True)[source]

Bases: object

static init_db()[source]
static reset()[source]
class glance.tests.unit.utils.FakeGateway(image_factory=None, image_member_factory=None, image_repo=None, task_factory=None, task_repo=None)[source]

Bases: object

get_image_factory(context)[source]
get_image_member_factory(context)[source]
get_repo(context)[source]
get_task_factory(context)[source]
get_task_repo(context)[source]
class glance.tests.unit.utils.FakeNotifier(*_args, **kwargs)[source]

Bases: object

critical(event_type, payload)[source]
debug(event_type, payload)[source]
error(event_type, payload)[source]
get_logs()[source]
info(event_type, payload)[source]
warn(event_type, payload)[source]
class glance.tests.unit.utils.FakePolicyEnforcer(*_args, **kwargs)[source]

Bases: object

enforce(_ctxt, action, target=None, **kwargs)[source]

Raise Forbidden if a rule for given action is set to false.

set_rules(rules)[source]
class glance.tests.unit.utils.FakeStoreAPI(store_metadata=None)[source]

Bases: object

add_to_backend(conf, image_id, data, size, scheme=None, context=None, verifier=None)[source]
check_location_metadata(val, key='')[source]
create_stores()[source]
get_from_backend(location, offset=0, chunk_size=None, context=None)[source]
get_size_from_backend(location, context=None)[source]
set_acls(uri, public=False, read_tenants=None, write_tenants=None, context=None)[source]
class glance.tests.unit.utils.FakeStoreUtils(store_api)[source]

Bases: object

delete_image_location_from_backend(context, image_id, location)[source]
safe_delete_from_backend(context, id, location)[source]
schedule_delayed_delete_from_backend(context, id, location)[source]
validate_external_location(uri)[source]
class glance.tests.unit.utils.FakeTask(task_id, type=None, status=None)[source]

Bases: object

fail(message)[source]
success(result)[source]
glance.tests.unit.utils.fake_get_size_from_backend(uri, context=None)[source]
glance.tests.unit.utils.fake_get_verifier(context, img_signature_certificate_uuid, img_signature_hash_method, img_signature, img_signature_key_type)[source]
glance.tests.unit.utils.get_fake_request(path='', method='POST', is_admin=False, user='54492ba0-f4df-4e4e-be62-27f4d76b29cf', roles=None, tenant='6838eb7b-6ded-434a-882c-b344c77fe8df')[source]
glance.tests.unit.utils.sort_url_by_qs_keys(url)[source]

Module contents