keystoneauth1.tests.unit package¶
Subpackages¶
- keystoneauth1.tests.unit.access package
- keystoneauth1.tests.unit.exceptions package
- keystoneauth1.tests.unit.extras package
- Subpackages
- keystoneauth1.tests.unit.extras.kerberos package
- Submodules
- keystoneauth1.tests.unit.extras.kerberos.base module
- keystoneauth1.tests.unit.extras.kerberos.test_fedkerb_loading module
- keystoneauth1.tests.unit.extras.kerberos.test_kerberos_loading module
- keystoneauth1.tests.unit.extras.kerberos.test_mapped module
- keystoneauth1.tests.unit.extras.kerberos.test_v3 module
- keystoneauth1.tests.unit.extras.kerberos.utils module
- Module contents
- keystoneauth1.tests.unit.extras.oauth1 package
- keystoneauth1.tests.unit.extras.saml2 package
- keystoneauth1.tests.unit.extras.kerberos package
- Module contents
- Subpackages
- keystoneauth1.tests.unit.identity package
- Submodules
- keystoneauth1.tests.unit.identity.test_access module
- keystoneauth1.tests.unit.identity.test_identity_common module
- keystoneauth1.tests.unit.identity.test_identity_v2 module
- keystoneauth1.tests.unit.identity.test_identity_v3 module
- keystoneauth1.tests.unit.identity.test_identity_v3_federation module
- keystoneauth1.tests.unit.identity.test_identity_v3_oidc module
- keystoneauth1.tests.unit.identity.test_password module
- keystoneauth1.tests.unit.identity.test_token module
- keystoneauth1.tests.unit.identity.test_tokenless_auth module
- keystoneauth1.tests.unit.identity.utils module
- Module contents
- keystoneauth1.tests.unit.loading package
- Submodules
- keystoneauth1.tests.unit.loading.test_adapter module
- keystoneauth1.tests.unit.loading.test_cli module
- keystoneauth1.tests.unit.loading.test_conf module
- keystoneauth1.tests.unit.loading.test_entry_points module
- keystoneauth1.tests.unit.loading.test_generic module
- keystoneauth1.tests.unit.loading.test_loading module
- keystoneauth1.tests.unit.loading.test_session module
- keystoneauth1.tests.unit.loading.test_v3 module
- keystoneauth1.tests.unit.loading.utils module
- Module contents
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¶
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': {'user': {'id': 'e6c2dd45ad3745fba5c5900d58c54daa', 'name': 'test_user_name'}, 'token': {'issued_at': '2017-05-02T17:28:00.461047', 'id': '66e94b682b3c4b4f8a155486c222c7a8', 'expires': '2017-05-02T18:28:00.461047', 'tenant': {'id': 'f4f4f9001ae9489a9cb21241554fdd7b', 'name': 'test_tenant_name'}, 'audit_ids': ['70128f16790748529cc781c6e48aa3ad', None]}}}¶
-
setUp
()¶
-
test_keystoneauth_betamax_fixture
()¶
-
test_replay_of_bad_url_fails
()¶
-
-
class
keystoneauth1.tests.unit.test_betamax_fixture.
TestBetamaxFixtureSerializerBehaviour
(*args, **kwargs)¶ Bases:
testtools.testcase.TestCase
Test the fixture’s logic, not its monkey-patching.
The setUp method of our BetamaxFixture monkey-patches the function to construct a session. We don’t need to test that particular bit of logic here so we do not need to call useFixture in our setUp method.
-
test_can_pass_custom_serializer
(*args, **keywargs)¶
-
test_can_pass_serializer_name
()¶
-
test_no_request_matchers_provided
()¶
-
test_no_serializer_options_provided
()¶
-
test_request_matchers
()¶
-
keystoneauth1.tests.unit.test_betamax_hooks module¶
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¶
keystoneauth1.tests.unit.test_matchers module¶
-
class
keystoneauth1.tests.unit.test_matchers.
TestXMLEquals
(*args, **kwargs)¶ Bases:
testtools.testcase.TestCase
-
describe_examples
= [('expected =\n<test xmlns="https://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="https://docs.openstack.org/identity/api/v2.0">\n <nope_it_fails/>\n</test>\n', '<?xml version="1.0" encoding="UTF-8"?>\n<test xmlns="https://docs.openstack.org/identity/api/v2.0">\n <nope_it_fails/>\n</test>\n', <keystoneauth1.tests.unit.matchers.XMLEquals object>)]¶
-
equivalent_xml
= '<?xml version="1.0" encoding="UTF-8"?>\n<test xmlns="https://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>¶
-
matches_matches
= ['<?xml version="1.0" encoding="UTF-8"?>\n<test xmlns="https://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="https://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="https://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="https://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="https://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="https://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="https://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="https://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>)]¶
-
test__str__
()¶
-
test_describe_difference
()¶
-
test_matches_match
()¶
-
test_mismatch_details
()¶
-
keystoneauth1.tests.unit.test_service_token module¶
-
class
keystoneauth1.tests.unit.test_service_token.
ServiceTokenTests
(*args, **kwargs)¶ Bases:
keystoneauth1.tests.unit.utils.TestCase
-
SERVICE_URL
= 'http://service-keystone.example.com/v3'¶
-
TEST_URL
= 'http://test.example.com/path/'¶
-
USER_URL
= 'http://user-keystone.example.com/v3'¶
-
setUp
()¶
-
test_invalidation
()¶
-
test_pass_throughs
()¶
-
test_setting_service_token
()¶
-
keystoneauth1.tests.unit.test_session module¶
-
class
keystoneauth1.tests.unit.test_session.
AdapterTest
(*args, **kwargs)¶ Bases:
keystoneauth1.tests.unit.utils.TestCase
-
ALLOW
= {'allow_deprecated': False, 'allow_experimental': True, 'allow_unknown': True}¶
-
INTERFACE
= 'a0b8677349294d69b1dd8e254f969c06'¶
-
REGION_NAME
= '84a7ebb8b85e4f448c6e35a9c3ece37f'¶
-
SERVICE_NAME
= 'fe2c2ad14a7347009beebc2dd35d3503'¶
-
SERVICE_TYPE
= 'e16a188e9646420294633f247ca5e0e5'¶
-
TEST_URL
= 'http://fakeendpoint/'¶
-
USER_AGENT
= 'c2903bddb1b2430bacd22d89b08c04a7'¶
-
VERSION
= '0f35005cf3364c8a9f01ae395376333d'¶
-
test_adapter_connect_retries
()¶
-
test_adapter_get_token
()¶
-
test_adapter_invalidate
()¶
-
test_adapter_user_agent_adapter
()¶
-
test_adapter_user_agent_session
()¶
-
test_adapter_user_agent_session_adapter
()¶
-
test_adapter_user_agent_session_adapter_additional
()¶
-
test_adapter_user_agent_session_adapter_no_app_version
()¶
-
test_adapter_user_agent_session_adapter_no_client_version
()¶
-
test_adapter_user_agent_session_override
()¶
-
test_adapter_user_agent_session_version_on_adapter
()¶
-
test_additional_headers
()¶
-
test_additional_headers_overrides
()¶
-
test_legacy_binding
()¶
-
test_legacy_binding_non_json_resp
()¶
-
test_logger_object_passed
()¶
-
test_methods
()¶
-
test_nested_adapters
()¶
-
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='2ee3d43bb1d249048f09a4b34448b164', 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
= {'compute': {'admin': 'http://compute-admin:2222/v1.0', 'public': 'http://compute-public:2222/v1.0'}, 'image': {'admin': 'http://image-admin:3333/v2.0', 'public': 'http://image-public:3333/v2.0'}, 'identity': {'admin': 'http://identity-admin:1111/v2.0', 'public': 'http://identity-public:1111/v2.0'}}¶
-
TEST_PROJECT_ID
= 'aProject'¶
-
TEST_TOKEN
= '2ee3d43bb1d249048f09a4b34448b164'¶
-
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
= 'dff05b2173fa4fdf95de20955a85a033'¶
-
TOKEN
= '2ee3d43bb1d249048f09a4b34448b164'¶
-
USER_ID
= '900a070c370f43c5aaba6e9094442ff0'¶
-
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_json_content_type
()¶
-
test_logging_body_only_for_specified_content_types
()¶ Verify response body is only logged in specific content types.
Response bodies are logged only when the response’s Content-Type header is set to application/json. This prevents us to get an unexpected MemoryError when reading arbitrary responses, such as streams.
-
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_session_debug_output_logs_openstack_request_id
()¶ Test x-openstack-request-id is logged in debug logs.
-
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
()¶
-
keystoneauth1.tests.unit.test_utils module¶
keystoneauth1.tests.unit.utils module¶
-
class
keystoneauth1.tests.unit.utils.
TestCase
(*args, **kwargs)¶ Bases:
testtools.testcase.TestCase
-
TEST_DOMAIN_ID
= '81b6a521fbe74600b309665156e342fa'¶
-
TEST_DOMAIN_NAME
= '427a93120c0448da87b61adbd7349fb5'¶
-
TEST_GROUP_ID
= 'de7f31c081eb42bb8b74d88cc2d12df4'¶
-
TEST_ROLE_ID
= '67509f464fcc41fdbd33ba6e6c1ad5a4'¶
-
TEST_ROOT_URL
= 'http://127.0.0.1:5000/'¶
-
TEST_TENANT_ID
= '473bf9fea2f04052b6de9d50d36b578d'¶
-
TEST_TENANT_NAME
= '2bba5c58387c4962ae70ff8b5e67f4e7'¶
-
TEST_TOKEN
= '2ee3d43bb1d249048f09a4b34448b164'¶
-
TEST_TRUST_ID
= '7a07134d967446068bfb99cf5869fe72'¶
-
TEST_USER
= '465c9ffd38ba4dafb4d37d3678b680ce'¶
-
TEST_USER_ID
= '5392f0511eb64bbf991485fc2ef0ff01'¶
-
assertContentTypeIs
(content_type)¶
-
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)¶
-