keystoneauth1.tests.unit package
Submodules
keystoneauth1.tests.unit.client_fixtures module
-
keystoneauth1.tests.unit.client_fixtures.domain_scoped_token()
-
keystoneauth1.tests.unit.client_fixtures.project_scoped_token()
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.
Examples contains various keystoneauth hacking style checks.
-
oslo_namespace_imports = {'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')], '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 '}
keystoneauth1.tests.unit.matchers module
-
class keystoneauth1.tests.unit.matchers.XMLEquals(expected)
Bases: object
Parses two XML documents from strings and compares the results.
-
match(other)
-
class keystoneauth1.tests.unit.matchers.XMLMismatch(expected, other)
Bases: testtools.matchers._impl.Mismatch
-
describe()
keystoneauth1.tests.unit.oidc_fixtures module
keystoneauth1.tests.unit.test_betamax_fixture module
-
class keystoneauth1.tests.unit.test_betamax_fixture.TestBetamaxFixture(*args, **kwargs)
Bases: testtools.testcase.TestCase
-
TEST_AUTH_URL = 'http://keystoneauth.betamax_test/v2.0/'
-
TEST_PASSWORD = 'test_password'
-
TEST_TENANT_NAME = 'test_tenant_name'
-
TEST_USERNAME = 'test_user_name'
-
V2_TOKEN = {'access': {'token': {'issued_at': '2016-10-14T00:34:05.364726', 'tenant': {'name': 'test_tenant_name', 'id': 'b1d22a8824834ae8859c906d56433d0a'}, 'expires': '2016-10-14T01:34:05.364726', 'audit_ids': ['b6756101d9564e099259db71af06eedf', None], 'id': '1b67cc2f12ab4187b0a8b6dd42e97b7c'}, 'user': {'name': 'test_user_name', 'id': 'f73a3271ec234073914b6f85c9189d65'}}}
-
setUp()
-
test_keystoneauth_betamax_fixture()
-
test_replay_of_bad_url_fails()
keystoneauth1.tests.unit.test_betamax_hooks module
-
class keystoneauth1.tests.unit.test_betamax_hooks.TestBetamaxHooks(*args, **kwargs)
Bases: testtools.testcase.TestCase
-
test_pre_record_hook_v2()
-
test_pre_record_hook_v3()
keystoneauth1.tests.unit.test_betamax_serializer module
-
class keystoneauth1.tests.unit.test_betamax_serializer.TestBetamaxSerializer(*args, **kwargs)
Bases: testtools.testcase.TestCase
-
TEST_FILE = '/home/jenkins/workspace/keystoneauth-docs-ubuntu-xenial/keystoneauth1/tests/unit/data/ksa_betamax_test_cassette.yaml'
-
TEST_JSON = '/home/jenkins/workspace/keystoneauth-docs-ubuntu-xenial/keystoneauth1/tests/unit/data/ksa_serializer_data.json'
-
setUp()
-
test_deserialize()
-
test_serialize()
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_is_admin_project()
-
test_oauth_scoped()
-
test_project_as_domain_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_matchers module
-
class keystoneauth1.tests.unit.test_matchers.TestXMLEquals(*args, **kwargs)
Bases: testtools.testcase.TestCase, testtools.tests.matchers.helpers.TestMatchersInterface
-
describe_examples = [('expected =\n<test xmlns="http://docs.openstack.org/identity/api/v2.0">\n <first z="0" y="1" x="2"/>\n <second a="a" b="b"/>\n</test>\n\nactual =\n<test xmlns="http://docs.openstack.org/identity/api/v2.0">\n <nope_it_fails/>\n</test>\n', '<?xml version="1.0" encoding="UTF-8"?>\n<test xmlns="http://docs.openstack.org/identity/api/v2.0">\n <nope_it_fails/>\n</test>\n', <keystoneauth1.tests.unit.matchers.XMLEquals object at 0x7fadc75fa750>)]
-
equivalent_xml = '<?xml version="1.0" encoding="UTF-8"?>\n<test xmlns="http://docs.openstack.org/identity/api/v2.0">\n <second a="a" b="b"/>\n <first z="0" y="1" x="2"></first>\n</test>\n'
-
matches_matcher = <keystoneauth1.tests.unit.matchers.XMLEquals object at 0x7fadc75fa750>
-
matches_matches = ['<?xml version="1.0" encoding="UTF-8"?>\n<test xmlns="http://docs.openstack.org/identity/api/v2.0">\n <first z="0" y="1" x="2"/>\n <second a="a" b="b"></second>\n</test>\n', '<?xml version="1.0" encoding="UTF-8"?>\n<test xmlns="http://docs.openstack.org/identity/api/v2.0">\n <second a="a" b="b"/>\n <first z="0" y="1" x="2"></first>\n</test>\n']
-
matches_mismatches = ['<?xml version="1.0" encoding="UTF-8"?>\n<test xmlns="http://docs.openstack.org/identity/api/v2.0">\n <nope_it_fails/>\n</test>\n']
-
matches_xml = '<?xml version="1.0" encoding="UTF-8"?>\n<test xmlns="http://docs.openstack.org/identity/api/v2.0">\n <first z="0" y="1" x="2"/>\n <second a="a" b="b"></second>\n</test>\n'
-
mismatches_description = 'expected =\n<test xmlns="http://docs.openstack.org/identity/api/v2.0">\n <first z="0" y="1" x="2"/>\n <second a="a" b="b"/>\n</test>\n\nactual =\n<test xmlns="http://docs.openstack.org/identity/api/v2.0">\n <nope_it_fails/>\n</test>\n'
-
mismatches_xml = '<?xml version="1.0" encoding="UTF-8"?>\n<test xmlns="http://docs.openstack.org/identity/api/v2.0">\n <nope_it_fails/>\n</test>\n'
-
str_examples = [('XMLEquals(\'<?xml version="1.0" encoding="UTF-8"?>\\n<test xmlns="http://docs.openstack.org/identity/api/v2.0">\\n <first z="0" y="1" x="2"/>\\n <second a="a" b="b"></second>\\n</test>\\n\')', <keystoneauth1.tests.unit.matchers.XMLEquals object at 0x7fadc75fa750>)]
keystoneauth1.tests.unit.test_session module
-
class keystoneauth1.tests.unit.test_session.AdapterTest(*args, **kwargs)
Bases: keystoneauth1.tests.unit.utils.TestCase
-
ALLOW = {'allow_experimental': True, 'allow_unknown': True, 'allow_deprecated': False}
-
INTERFACE = '8fbec3fb3f8f4f5791aac1c5d3bc45fc'
-
REGION_NAME = 'd1879d4e2192448c8c44f033c8487007'
-
SERVICE_NAME = '7b1010f29cae41a4b6fb0ed8fd1be153'
-
SERVICE_TYPE = '6f8e9b785ac644a7a16881b0fa095422'
-
TEST_URL = 'http://fakeendpoint/'
-
USER_AGENT = '0addb58d1f684979a015d2f84f60127e'
-
VERSION = '5ac84b9814294411bacbf13933f51fcd'
-
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_unknown_connection_error()
-
test_user_and_project_id()
-
class keystoneauth1.tests.unit.test_session.AuthPlugin(token='86fff95f06704d499c1098e985a7007d', 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'}, 'image': {'public': 'http://image-public:3333/v2.0', 'admin': 'http://image-admin:3333/v2.0'}, 'compute': {'public': 'http://compute-public:2222/v1.0', 'admin': 'http://compute-admin:2222/v1.0'}}
-
TEST_PROJECT_ID = 'aProject'
-
TEST_TOKEN = '86fff95f06704d499c1098e985a7007d'
-
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/'
-
PROJECT_ID = '423f6a08c8a1401293237e27bc33816f'
-
USER_ID = 'fb110cb0c0c6441aa37feafce34d22d9'
-
get_endpoint(session, **kwargs)
-
get_project_id(session, **kwargs)
-
get_token(session)
-
get_user_id(session, **kwargs)
-
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_permanent_redirect_308()
-
test_redirect_forever()
-
test_redirect_limit()
-
class keystoneauth1.tests.unit.test_session.RequestsAuth(*args, **kwargs)
Bases: requests.auth.AuthBase
-
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_does_id_replacement()
-
test_endpoint_override_fails_to_do_unknown_replacement()
-
test_endpoint_override_fails_to_replace_if_none()
-
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()
-
class keystoneauth1.tests.unit.test_session.TCPKeepAliveAdapterTest(*args, **kwargs)
Bases: keystoneauth1.tests.unit.utils.TestCase
-
patch(target, name, *args, **kwargs)
-
patch_socket_with_options(option_names)
-
setUp()
-
test_init_poolmanager_with_basic_options()
-
test_init_poolmanager_with_given_optionsl()
-
test_init_poolmanager_with_requests_lesser_than_2_4_1()
-
test_init_poolmanager_with_tcp_keepcnt()
-
test_init_poolmanager_with_tcp_keepcnt_on_windows()
-
test_init_poolmanager_with_tcp_keepidle()
-
test_init_poolmanager_with_tcp_keepintvl()
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_deprecated_options()
-
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 = '5adaef8bfec54bfbb4923922c119895f'
-
TEST_DOMAIN_NAME = '8ddb5bb69edb45a087af6527930094c1'
-
TEST_GROUP_ID = '736c9b763ee047bb8b3fe5d9a81327ef'
-
TEST_ROLE_ID = 'd51b3b563c494706977e7c0ae527b716'
-
TEST_ROOT_URL = 'http://127.0.0.1:5000/'
-
TEST_TENANT_ID = 'a793838bbd5a4d3ab25bf23b00782534'
-
TEST_TENANT_NAME = '79ca7baf96de4cf9beea675c228b8962'
-
TEST_TOKEN = '86fff95f06704d499c1098e985a7007d'
-
TEST_TRUST_ID = '5d02a91ab32240e9bbcd8820019a675b'
-
TEST_USER = 'cef2a1ad52c745b5b378eae34af3ace9'
-
TEST_USER_ID = '784de1d90b034f89a4b25ec866278f25'
-
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)
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)
-
class keystoneauth1.tests.unit.utils.TestResponse(data)
Bases: requests.models.Response
Class used to wrap requests.Response.
This provides some convenience to initialize with a dict.
-
text
Module contents