keystoneauth1.tests.unit package

Submodules

keystoneauth1.tests.unit.k2k_fixtures module

keystoneauth1.tests.unit.keystoneauth_fixtures module

class keystoneauth1.tests.unit.keystoneauth_fixtures.HackingCode

Bases: fixtures.fixture.Fixture

A fixture to house the various code examples for the keystoneclient hacking style checks.

oslo_namespace_imports = {'code': '\n import oslo.utils\n import oslo_utils\n import oslo.utils.encodeutils\n import oslo_utils.encodeutils\n from oslo import utils\n from oslo.utils import encodeutils\n from oslo_utils import encodeutils\n\n import oslo.serialization\n import oslo_serialization\n import oslo.serialization.jsonutils\n import oslo_serialization.jsonutils\n from oslo import serialization\n from oslo.serialization import jsonutils\n from oslo_serialization import jsonutils\n\n import oslo.config\n import oslo_config\n import oslo.config.cfg\n import oslo_config.cfg\n from oslo import config\n from oslo.config import cfg\n from oslo_config import cfg\n\n import oslo.i18n\n import oslo_i18n\n import oslo.i18n.log\n import oslo_i18n.log\n from oslo import i18n\n from oslo.i18n import log\n from oslo_i18n import log\n ', 'expected_errors': [(1, 0, 'K333'), (3, 0, 'K333'), (5, 0, 'K333'), (6, 0, 'K333'), (9, 0, 'K333'), (11, 0, 'K333'), (13, 0, 'K333'), (14, 0, 'K333'), (17, 0, 'K333'), (19, 0, 'K333'), (21, 0, 'K333'), (22, 0, 'K333'), (25, 0, 'K333'), (27, 0, 'K333'), (29, 0, 'K333'), (30, 0, 'K333')]}

keystoneauth1.tests.unit.test_discovery module

class keystoneauth1.tests.unit.test_discovery.CatalogHackTests(*args, **kwargs)

Bases: keystoneauth1.tests.unit.utils.TestCase

BASE_URL = 'http://keystone.server:5000/'
IDENTITY = 'identity'
OTHER_URL = 'http://other.server:5000/path'
TEST_URL = 'http://keystone.server:5000/v2.0'
V2_URL = 'http://keystone.server:5000/v2.0'
V3_URL = 'http://keystone.server:5000/v3'
setUp()
test_ignored_non_service_type()
test_version_hacks()
class keystoneauth1.tests.unit.test_discovery.DiscoverUtils(*args, **kwargs)

Bases: keystoneauth1.tests.unit.utils.TestCase

test_version_number()

keystoneauth1.tests.unit.test_fixtures module

class keystoneauth1.tests.unit.test_fixtures.V2TokenTests(*args, **kwargs)

Bases: keystoneauth1.tests.unit.utils.TestCase

test_roles()
test_services()
test_tenant_scoped()
test_token_bind()
test_trust_scoped()
test_unscoped()
class keystoneauth1.tests.unit.test_fixtures.V3TokenTests(*args, **kwargs)

Bases: keystoneauth1.tests.unit.utils.TestCase

test_catalog()
test_domain_scoped()
test_empty_default_service_providers()
test_oauth_scoped()
test_project_scoped()
test_roles()
test_service_providers()
test_token_bind()
test_trust_scoped()
test_unscoped()

keystoneauth1.tests.unit.test_hacking_checks module

class keystoneauth1.tests.unit.test_hacking_checks.TestCheckOsloNamespaceImports(*args, **kwargs)

Bases: testtools.testcase.TestCase

assert_has_errors(code, expected_errors=None)
run_check(*args, **keywargs)
test()

keystoneauth1.tests.unit.test_session module

class keystoneauth1.tests.unit.test_session.AdapterTest(*args, **kwargs)

Bases: keystoneauth1.tests.unit.utils.TestCase

INTERFACE = '8aedb4f2653b4a8f920073019a7e388c'
REGION_NAME = '2136b7b1e9184ef7b42f259bbba8cbee'
SERVICE_NAME = '7c8173d837484ca1a609179ed44aad55'
SERVICE_TYPE = 'b8592d1bd26045be931f180f22a45416'
TEST_URL = 'http://fakeendpoint/'
USER_AGENT = '2e9d08995c104db48e8a509138409644'
VERSION = '7190faeac7e9485c85dc6528844f779c'
test_adapter_connect_retries()
test_adapter_get_token()
test_adapter_invalidate()
test_legacy_binding()
test_legacy_binding_non_json_resp()
test_logger_object_passed()
test_methods()
test_setting_endpoint_override()
test_setting_variables_on_get_endpoint()
test_setting_variables_on_request()
test_user_and_project_id()
class keystoneauth1.tests.unit.test_session.AuthPlugin(token='469f19893e0746b28e1eb4e9e34d0bbc', invalidate=True)

Bases: keystoneauth1.plugin.BaseAuthPlugin

Very simple debug authentication plugin.

Takes Parameters such that it can throw exceptions at the right times.

SERVICE_URLS = {'identity': {'public': 'http://identity-public:1111/v2.0', 'admin': 'http://identity-admin:1111/v2.0'}, 'compute': {'public': 'http://compute-public:2222/v1.0', 'admin': 'http://compute-admin:2222/v1.0'}, 'image': {'public': 'http://image-public:3333/v2.0', 'admin': 'http://image-admin:3333/v2.0'}}
TEST_PROJECT_ID = 'aProject'
TEST_TOKEN = '469f19893e0746b28e1eb4e9e34d0bbc'
TEST_USER_ID = 'aUser'
get_endpoint(session, service_type=None, interface=None, **kwargs)
get_project_id(session)
get_token(session)
get_user_id(session)
invalidate()
class keystoneauth1.tests.unit.test_session.CalledAuthPlugin(invalidate=True)

Bases: keystoneauth1.plugin.BaseAuthPlugin

ENDPOINT = 'http://fakeendpoint/'
get_endpoint(session, **kwargs)
get_token(session)
invalidate()
class keystoneauth1.tests.unit.test_session.RedirectTests(*args, **kwargs)

Bases: keystoneauth1.tests.unit.utils.TestCase

DEFAULT_REDIRECT_BODY = 'Redirect'
DEFAULT_RESP_BODY = 'Found'
REDIRECT_CHAIN = ['http://myhost:3445/', 'http://anotherhost:6555/', 'http://thirdhost/', 'http://finaldestination:55/']
assertResponse(resp)
setup_redirects(method='GET', status_code=305, redirect_kwargs={}, final_kwargs={})
test_basic_get()
test_basic_post_keeps_correct_method()
test_history_matches_requests()
test_no_redirect()
test_redirect_forever()
test_redirect_limit()
class keystoneauth1.tests.unit.test_session.SessionAuthTests(*args, **kwargs)

Bases: keystoneauth1.tests.unit.utils.TestCase

TEST_JSON = {'hello': 'world'}
TEST_URL = 'http://127.0.0.1:5000/'
stub_service_url(service_type, interface, path, method='GET', **kwargs)
test_auth_plugin_default_with_plugin()
test_auth_plugin_disable()
test_endpoint_override_ignore_full_url()
test_endpoint_override_overrides_filter()
test_logger_object_passed()
test_passed_auth_plugin()
test_passed_auth_plugin_overrides()
test_raises_exc_only_when_asked()
test_reauth_called()
test_reauth_not_called()
test_requests_auth_plugin()
test_service_type_urls()
test_service_url_raises_if_no_auth_plugin()
test_service_url_raises_if_no_url_returned()
test_user_and_project_id()
class keystoneauth1.tests.unit.test_session.SessionTests(*args, **kwargs)

Bases: keystoneauth1.tests.unit.utils.TestCase

TEST_URL = 'http://127.0.0.1:5000/'
test_connect_retries()
test_delete()
test_does_not_set_tcp_keepalive_on_custom_sessions()
test_get()
test_head()
test_http_session_opts()
test_logging_cacerts()
test_logs_failed_output()

Test that output is logged even for failed requests

test_not_found()
test_patch()
test_post()
test_put()
test_server_error()
test_session_debug_output()

Test request and response headers in debug logs

in order to redact secure headers while debug is true.

test_ssl_error_message()
test_user_agent()
test_uses_tcp_keepalive_by_default()

keystoneauth1.tests.unit.test_token_endpoint module

class keystoneauth1.tests.unit.test_token_endpoint.AdminTokenTest(*args, **kwargs)

Bases: keystoneauth1.tests.unit.utils.TestCase

test_token_endpoint_options()
class keystoneauth1.tests.unit.test_token_endpoint.TokenEndpointTest(*args, **kwargs)

Bases: keystoneauth1.tests.unit.utils.TestCase

TEST_TOKEN = 'aToken'
TEST_URL = 'http://server/prefix'
test_basic_case()
test_basic_endpoint_case()
test_token_endpoint_user_id()

keystoneauth1.tests.unit.test_utils module

class keystoneauth1.tests.unit.test_utils.UtilsTests(*args, **kwargs)

Bases: testtools.testcase.TestCase

test_get_logger()

keystoneauth1.tests.unit.utils module

class keystoneauth1.tests.unit.utils.TestCase(*args, **kwargs)

Bases: testtools.testcase.TestCase

TEST_DOMAIN_ID = '0809848deb8a4135aa45b2a4b096d079'
TEST_DOMAIN_NAME = '42c882731cc748b987f9b248e044be42'
TEST_GROUP_ID = 'a7e8c3009d934e559bc9d7374da6a47b'
TEST_ROLE_ID = '2ce046859522451ea1b0cd2b00502d98'
TEST_ROOT_URL = 'http://127.0.0.1:5000/'
TEST_TENANT_ID = '21d578fff59640cdaf8ce2162bbe3ff3'
TEST_TENANT_NAME = '15a53d4d8ae04dffbc08d31cfd45fa25'
TEST_TOKEN = '469f19893e0746b28e1eb4e9e34d0bbc'
TEST_TRUST_ID = 'a95e294effd14bd9b7ff5e39da285af4'
TEST_USER = '80f5aa56244446818110cd62e94d1423'
TEST_USER_ID = 'e2bb1fc0693040ef8f2cf0658cd1a400'
assertQueryStringContains(**kwargs)

Verify the query string contains the expected parameters.

This method is used to verify that the query string for the most recent request made contains all the parameters provided as kwargs, and that the value of each parameter contains the value for the kwarg. If the value for the kwarg is an empty string (‘’), then all that’s verified is that the parameter is present.

assertQueryStringIs(qs='')

Verify the QueryString matches what is expected.

The qs parameter should be of the format ‘foo=bar&abc=xyz’

assertRequestBodyIs(body=None, json=None)
assertRequestHeaderEqual(name, val)

Verify that the last request made contains a header and its value

The request must have already been made.

setUp()
stub_url(method, parts=None, base_url=None, json=None, **kwargs)
tearDown()
class keystoneauth1.tests.unit.utils.TestResponse(data)

Bases: requests.models.Response

Class used to wrap requests.Response and provide some convenience to initialize with a dict.

text

Module contents