glance.tests.unit package¶
Subpackages¶
- glance.tests.unit.api package
- glance.tests.unit.async package
- glance.tests.unit.common package
- Subpackages
- Submodules
- glance.tests.unit.common.test_client module
- glance.tests.unit.common.test_config module
- glance.tests.unit.common.test_exception module
- glance.tests.unit.common.test_location_strategy module
- glance.tests.unit.common.test_property_utils module
- glance.tests.unit.common.test_rpc module
- glance.tests.unit.common.test_scripts module
- glance.tests.unit.common.test_semver module
- glance.tests.unit.common.test_swift_store_utils module
- glance.tests.unit.common.test_timeutils module
- glance.tests.unit.common.test_utils module
- glance.tests.unit.common.test_wsgi module
- glance.tests.unit.common.test_wsgi_ipv6 module
- Module contents
- glance.tests.unit.v1 package
- glance.tests.unit.v2 package
- Submodules
- glance.tests.unit.v2.test_image_actions_resource module
- glance.tests.unit.v2.test_image_data_resource module
- glance.tests.unit.v2.test_image_members_resource module
- glance.tests.unit.v2.test_image_tags_resource module
- glance.tests.unit.v2.test_images_resource module
- glance.tests.unit.v2.test_metadef_resources module
- glance.tests.unit.v2.test_registry_api module
- glance.tests.unit.v2.test_registry_client module
- glance.tests.unit.v2.test_schemas_resource module
- glance.tests.unit.v2.test_tasks_resource module
- Module contents
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¶
-
glance.tests.unit.fake_rados module¶
-
class
glance.tests.unit.fake_rados.
mock_rados
[source]¶ Bases:
object
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.
TestImageRepoProxy
(*args, **kwargs)[source]¶
-
class
glance.tests.unit.test_auth.
TestImmutableImage
(*args, **kwargs)[source]¶ Bases:
glance.tests.utils.BaseTestCase
-
class
glance.tests.unit.test_auth.
TestKeystoneAuthPlugin
(*args, **kwargs)[source]¶ Bases:
glance.tests.utils.BaseTestCase
Test that the Keystone auth plugin works properly
-
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
-
-
class
glance.tests.unit.test_auth.
TestTaskRepoProxy
(*args, **kwargs)[source]¶
glance.tests.unit.test_cache_middleware module¶
-
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.
TestCacheMiddlewareChecksumVerification
(*args, **kwargs)[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_meta_not_found
()[source]¶ Test process_request for v1 api where registry raises NotFound exception as image metadata not found.
-
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.
-
-
class
glance.tests.unit.test_cache_middleware.
TestCacheMiddlewareProcessResponse
(*args, **kwargs)[source]¶ Bases:
glance.tests.unit.base.IsolatedUnitTest
-
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_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.
-
-
class
glance.tests.unit.test_cache_middleware.
TestCacheMiddlewareRequestStashCacheInfo
(*args, **kwargs)[source]¶ Bases:
testtools.testcase.TestCase
glance.tests.unit.test_cached_images module¶
-
class
glance.tests.unit.test_cached_images.
FakePolicyEnforcer
[source]¶ Bases:
glance.api.policy.Enforcer
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.
-
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.
-
glance.tests.unit.test_context_middleware module¶
glance.tests.unit.test_data_migration_framework module¶
glance.tests.unit.test_db module¶
-
class
glance.tests.unit.test_db.
TestImageRepo
(*args, **kwargs)[source]¶ Bases:
glance.tests.utils.BaseTestCase
glance.tests.unit.test_db_metadef module¶
-
class
glance.tests.unit.test_db_metadef.
TestMetadefRepo
(*args, **kwargs)[source]¶ Bases:
glance.tests.utils.BaseTestCase
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>¶
-
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.
TestImage
(*args, **kwargs)[source]¶ Bases:
glance.tests.utils.BaseTestCase
-
class
glance.tests.unit.test_domain.
TestImageFactory
(*args, **kwargs)[source]¶ Bases:
glance.tests.utils.BaseTestCase
glance.tests.unit.test_domain_proxy module¶
-
class
glance.tests.unit.test_domain_proxy.
FakeImageMembershipFactory
(result=None)[source]¶ Bases:
object
-
class
glance.tests.unit.test_domain_proxy.
FakeRepo
(result=None)[source]¶ Bases:
object
-
add
(*args, **kwargs)¶
-
get
(*args, **kwargs)¶
-
list
(*args, **kwargs)¶
-
remove
(*args, **kwargs)¶
-
save
(*args, **kwargs)¶
-
glance.tests.unit.test_glance_manage module¶
glance.tests.unit.test_glance_replicator module¶
-
class
glance.tests.unit.test_glance_replicator.
FakeHttpResponse
(headers, data)[source]¶ Bases:
object
-
class
glance.tests.unit.test_glance_replicator.
FakeImageService
(http_conn, authtoken)[source]¶ Bases:
object
-
class
glance.tests.unit.test_glance_replicator.
ReplicationCommandsTestCase
(*args, **kwargs)[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>¶
-
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>¶
-
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
-
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
-
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>¶
-
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]¶
-
class
glance.tests.unit.test_glare_type_definition_framework.
TestDeclarativeProperties
(*args, **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_nonzero_stall_time
(*a, **kwargs)[source]¶ Test the clean method removes the stalled images as expected
-
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_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
-
-
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
-
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
glance.tests.unit.test_image_cache_client module¶
glance.tests.unit.test_jsonpatchmixin module¶
-
class
glance.tests.unit.test_jsonpatchmixin.
TestValidator
(methods_allowed=None)[source]¶ Bases:
glance.common.jsonpatchvalidator.JsonPatchValidatorMixin
glance.tests.unit.test_manage module¶
glance.tests.unit.test_misc module¶
glance.tests.unit.test_notifier module¶
-
class
glance.tests.unit.test_notifier.
ImageStub
(image_id, status, created_at, updated_at, **kwargs)[source]¶ Bases:
glance.domain.Image
-
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
-
class
glance.tests.unit.test_notifier.
TaskStub
(task_id, task_type, status, owner, expires_at, created_at, updated_at)[source]¶ Bases:
glance.domain.TaskStub
-
class
glance.tests.unit.test_notifier.
TestImageMemberNotifications
(*args, **kwargs)[source]¶ Bases:
glance.tests.utils.BaseTestCase
Test Image Member Notifications work
-
class
glance.tests.unit.test_notifier.
TestImageNotifications
(*args, **kwargs)[source]¶ Bases:
glance.tests.utils.BaseTestCase
Test Image Notifications work
-
class
glance.tests.unit.test_notifier.
TestTaskNotifications
(*args, **kwargs)[source]¶ Bases:
glance.tests.utils.BaseTestCase
Test Task Notifications work
glance.tests.unit.test_policy module¶
-
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
-
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.
TestPolicyEnforcerNoFile
(*args, **kwargs)[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': {}}]¶
-
size
= None¶
-
-
class
glance.tests.unit.test_quota.
TestImageTagQuotas
(*args, **kwargs)[source]¶ Bases:
glance.tests.utils.BaseTestCase
glance.tests.unit.test_schema module¶
glance.tests.unit.test_scrubber module¶
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>¶
-
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>¶
-
glance.tests.unit.test_store_image module¶
-
class
glance.tests.unit.test_store_image.
ImageStub
(image_id, status=None, locations=None, visibility=None, extra_properties=None)[source]¶ Bases:
object
glance.tests.unit.test_store_location module¶
-
class
glance.tests.unit.test_store_location.
TestStoreLocation
(*args, **kwargs)[source]¶
glance.tests.unit.test_versions module¶
-
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.
-
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.
glance.tests.unit.utils module¶
-
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
-
class
glance.tests.unit.utils.
FakePolicyEnforcer
(*_args, **kwargs)[source]¶ Bases:
object
-
glance.tests.unit.utils.
fake_get_verifier
(context, img_signature_certificate_uuid, img_signature_hash_method, img_signature, img_signature_key_type)[source]¶