glare.tests.unit package

Submodules

glare.tests.unit.base module

class glare.tests.unit.base.BaseTestArtifactAPI(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

class glare.tests.unit.base.BaseTestCase(*args, **kwargs)[source]

Bases: testtools.testcase.TestCase

config(**kw)[source]

Override some configuration values.

The keyword arguments are the names of configuration options to override and their values.

If a group argument is supplied, the overrides are applied to the specified configuration option group.

All overrides are automatically cleared at the end of the current test by the fixtures cleanup process.

static generate_json_patch(values)[source]
static get_fake_request(user)[source]
static policy(new_rules)[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

update_with_values(values, exc_class=None, art_type='sample_artifact', art_id=None)[source]

glare.tests.unit.glare_fixtures module

class glare.tests.unit.glare_fixtures.BannedDBSchemaOperations(banned_resources=None)[source]

Bases: fixtures.fixture.Fixture

Ban some operations for migrations

setUp()[source]

Prepare the Fixture for use.

This should not be overridden. Concrete fixtures should implement _setUp. Overriding of setUp is still supported, just not recommended.

After setUp has completed, the fixture will have one or more attributes which can be used (these depend totally on the concrete subclass).

Raises:MultipleExceptions if _setUp fails. The last exception captured within the MultipleExceptions will be a SetupError exception.
Returns:None.
Changed in 1.3:The recommendation to override setUp has been reversed - before 1.3, setUp() should be overridden, now it should not be.
Changed in 1.3.1:
 BaseException is now caught, and only subclasses of Exception are wrapped in MultipleExceptions.

glare.tests.unit.test_fixtures module

class glare.tests.unit.test_fixtures.TestBannedDBSchemaOperations(*args, **kwargs)[source]

Bases: testtools.testcase.TestCase

test_column()[source]
test_table()[source]

glare.tests.unit.test_hacking module

class glare.tests.unit.test_hacking.HackingTestCase(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestCase

test_assert_equal_none()[source]
test_assert_equal_type()[source]
test_assert_true_instance()[source]
test_check_python3_xrange()[source]
test_dict_constructor_with_list_copy()[source]
test_dict_iteritems()[source]
test_dict_iterkeys()[source]
test_dict_itervalues()[source]
test_factory()[source]
test_no_contextlib_nested()[source]
test_no_direct_use_of_unicode_function()[source]
test_no_translate_logs()[source]

glare.tests.unit.test_multistore module

class glare.tests.unit.test_multistore.TestMultistore(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestCase

test_multistore()[source]

glare.tests.unit.test_policies module

class glare.tests.unit.test_policies.TestPolicies(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestArtifactAPI

Test glare policies.

test_disable_type_list_api()[source]
test_download_from_any_artifact()[source]
test_get_any_artifact()[source]
test_list_all_artifacts()[source]

glare.tests.unit.test_quotas module

class glare.tests.unit.test_quotas.TestDynamicQuotas(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestArtifactAPI

Test dynamic quota limits.

test_calculate_uploaded_data()[source]
test_count_artifact_number()[source]
test_quota_upload_no_content_length()[source]
class glare.tests.unit.test_quotas.TestStaticQuotas(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestArtifactAPI

Test static quota limits.

test_calculate_uploaded_data()[source]
test_count_artifact_number()[source]
test_max_artifact_number_change_global_config_values()[source]
test_max_artifact_number_change_type_config_values()[source]
test_max_max_uploaded_data_change_type_config_values()[source]
test_max_uploaded_data_change_global_config_values()[source]

glare.tests.unit.test_store_api module

class glare.tests.unit.test_store_api.TestStoreAPI(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestArtifactAPI

test_read_data_database()[source]
test_read_data_filesystem()[source]
test_read_data_http()[source]
test_read_data_http_too_large_data()[source]

glare.tests.unit.test_unpacking module

class glare.tests.unit.test_unpacking.TestArtifactHooks(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestArtifactAPI

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_unpacking()[source]
test_unpacking_big_archive()[source]
test_unpacking_database()[source]
test_unpacking_database_big_archive()[source]
test_unpacking_more_than_max_size_archive()[source]

glare.tests.unit.test_utils module

class glare.tests.unit.test_utils.TestKeyCert(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestCase

test_validate_key_cert_cert_cant_read()[source]
test_validate_key_cert_key()[source]
test_validate_key_cert_key_cant_read()[source]
test_validate_key_cert_key_crypto_error()[source]
test_validate_key_cert_no_private_key()[source]
class glare.tests.unit.test_utils.TestReaders(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestCase

Test various readers in glare.common.utils

test_blob_iterator()[source]
test_blob_iterator_big_data()[source]
test_cooperative_reader_explicit_read()[source]
test_cooperative_reader_iterator()[source]

Ensure cooperative reader class accesses all bytes of file

test_cooperative_reader_no_read_method()[source]
test_cooperative_reader_no_read_method_buffer_size()[source]
test_cooperative_reader_of_iterator()[source]

Ensure cooperative reader supports iterator backends too

test_cooperative_reader_of_iterator_stop_iteration_err()[source]

Ensure cooperative reader supports iterator backends too

test_cooperative_reader_preserves_size_chunk_equals_read()[source]
test_cooperative_reader_preserves_size_chunk_less_then_read()[source]
test_cooperative_reader_preserves_size_chunk_more_then_read()[source]
test_limiting_reader()[source]

Ensure limiting reader class accesses all bytes of file

test_limiting_reader_fails()[source]

Ensure limiting reader class throws exceptions if limit exceeded

class glare.tests.unit.test_utils.TestUtils(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestCase

Test class for glare.common.utils

test_no_4bytes_params()[source]
test_split_filter_op()[source]
test_validate_quotes()[source]
test_validate_quotes_negative()[source]

glare.tests.unit.test_validation_hooks module

class glare.tests.unit.test_validation_hooks.TestArtifactHooks(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestArtifactAPI

test_add_location_hook()[source]
test_create_hook()[source]
test_delete_hook()[source]
test_update_ops_hook()[source]
test_upload_download_hooks()[source]

glare.tests.unit.test_validators module

class glare.tests.unit.test_validators.TestValidators(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestArtifactAPI

Class for testing field validators.

test_allowed_dict_keys()[source]
test_allowed_dict_values()[source]
test_allowed_list_values()[source]
test_allowed_values()[source]
test_forbidden_chars()[source]
test_max_dict_key_len()[source]
test_max_dict_size()[source]
test_max_list_size()[source]
test_max_number_size()[source]
test_max_str_len()[source]
test_min_dict_size()[source]
test_min_list_size()[source]
test_min_number_size()[source]
test_min_str_len()[source]
test_mix_dict_key_len()[source]
test_regex()[source]
test_required_dict_keys()[source]
test_unique()[source]
test_uuid()[source]

glare.tests.unit.test_versions module

class glare.tests.unit.test_versions.VersionsTest(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestCase

Test the version information returned from the API service.

test_root_endpoint()[source]
test_versions_endpoint()[source]

glare.tests.unit.test_wsgi module

class glare.tests.unit.test_wsgi.GetSocketTestCase(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_correct_configure_socket()[source]
test_get_socket_with_bind_problems()[source]
test_get_socket_with_unexpected_socket_errno()[source]
test_get_socket_without_all_ssl_reqs()[source]
class glare.tests.unit.test_wsgi.JSONRequestDeserializerTest(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestCase

test_default_no_body()[source]
test_default_with_body()[source]
test_from_json()[source]
test_from_json_malformed()[source]
test_get_bind_addr_default_value()[source]
test_has_body_has_content_length()[source]
test_has_body_has_transfer_encoding()[source]
test_has_body_invalid_transfer_encoding()[source]
test_has_body_invalid_transfer_encoding_no_content_len_and_body()[source]
test_has_body_invalid_transfer_encoding_no_content_len_but_body()[source]
test_has_body_invalid_transfer_encoding_with_content_length()[source]
test_has_body_multiple_transfer_encoding()[source]
test_has_body_no_content_length()[source]
test_has_body_valid_transfer_encoding_with_content_length()[source]
test_has_body_valid_transfer_encoding_without_content_length()[source]
test_has_body_zero_content_length()[source]
test_no_body_no_content_length()[source]
class glare.tests.unit.test_wsgi.JSONResponseSerializerTest(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestCase

test_default()[source]
test_to_json()[source]
test_to_json_with_date_format_value()[source]
test_to_json_with_more_deep_format()[source]
test_to_json_with_set()[source]
class glare.tests.unit.test_wsgi.RequestTest(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestCase

test_best_match_language_expected()[source]
test_best_match_language_unknown(**keywargs)[source]
test_content_range()[source]
test_content_range_invalid()[source]
test_http_error_response_codes()[source]

Makes sure v1 unallowed methods return 405

test_language_accept_default()[source]
test_language_accept_none()[source]
test_request_match_language_unexpected()[source]
class glare.tests.unit.test_wsgi.ResourceTest(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestCase

test_call()[source]
test_call_raises_exception()[source]
test_dispatch()[source]
test_dispatch_default()[source]
test_dispatch_no_default()[source]
test_get_action_args()[source]
test_get_action_args_del_controller_error()[source]
test_get_action_args_del_format_error()[source]
test_get_action_args_invalid_index()[source]
test_resource_call_error_handle_localized(**keywargs)[source]
test_response_headers_encoded()[source]
test_translate_exception(**keywargs)[source]
class glare.tests.unit.test_wsgi.ServerTest(*args, **kwargs)[source]

Bases: glare.tests.unit.base.BaseTestCase

test_create_pool()[source]

Ensure the wsgi thread pool is an eventlet.greenpool.GreenPool.

test_http_keepalive(**keywargs)[source]
test_number_of_workers()[source]

Ensure the default number of workers matches num cpus.

test_set_eventlet_hub_exception()[source]

Module contents

glare.tests.unit.fake_translate_msgid(msgid, domain, desired_locale=None)[source]