tests Package

client_fixtures Module

class keystoneclient.tests.client_fixtures.Examples

Bases: fixtures.fixture.Fixture

Example tokens and certs loaded from the examples directory.

To use this class correctly, the module needs to override the test suite class to use testresources.OptimisingTestSuite (otherwise the files will be read on every test). This is done by defining a load_tests function in the module, like this:

def load_tests(loader, tests, pattern):
return testresources.OptimisingTestSuite(tests)

(see http://docs.python.org/2/library/unittest.html#load-tests-protocol )

setUp()

fakes Module

A fake server that “responds” to API methods with pre-canned responses.

All of these responses come from the spec, so if for some reason the spec’s wrong the tests might raise AssertionError. I’ve indicated in comments the places where actual behavior differs from the spec.

class keystoneclient.tests.fakes.FakeClient

Bases: object

assert_called(method, url, body=None, pos=-1)

Assert than an API method was just called.

assert_called_anytime(method, url, body=None)

Assert than an API method was called anytime in the test.

authenticate(cl_obj)
clear_callstack()
keystoneclient.tests.fakes.assert_has_keys(dict, required=[], optional=[])

test_auth_token_middleware Module

class keystoneclient.tests.test_auth_token_middleware.BaseAuthTokenMiddlewareTest(*args, **kwargs)

Bases: testtools.testcase.TestCase

Base test class for auth_token middleware.

All the tests allow for running with auth_token configured for receiving v2 or v3 tokens, with the choice being made by passing configuration data into Setup().

The base class will, by default, run all the tests expecting v2 token formats. Child classes can override this to specify, for instance, v3 format.

assertLastPath(path)
setUp(expected_env=None, auth_version=None, fake_app=None)
set_middleware(fake_app=None, expected_env=None, conf=None)

Configure the class ready to call the auth_token middleware.

Set up the various fake items needed to run the middleware. Individual tests that need to further refine these can call this function to override the class defaults.

start_fake_response(status, headers)
class keystoneclient.tests.test_auth_token_middleware.CommonAuthTokenMiddlewareTest

Bases: object

assert_kerberos_bind(token, bind_level, use_kerberos=True, success=True)
assert_valid_request_200(token, with_catalog=True)
get_revocation_list_json(token_ids=None)
test_assert_valid_memcache_protection_config()
test_config_revocation_cache_timeout()
test_encrypt_cache_data(*args, **kwargs)
test_expired()
test_fetch_revocation_list()
test_get_revocation_list_returns_current_list_from_disk()
test_get_revocation_list_returns_current_list_from_memory()
test_get_revocation_list_returns_fetched_list()
test_get_token_revocation_list_fetched_time_returns_min()
test_get_token_revocation_list_fetched_time_returns_mtime()
test_get_token_revocation_list_fetched_time_returns_utc()
test_get_token_revocation_list_fetched_time_returns_value()
test_http_error_not_cached_token()

Test to don’t cache token as invalid on network errors.

We use UUID tokens since they are the easiest one to reach get_http_connection.

test_http_request_max_retries()
test_init_by_ipv6Addr_auth_host()
test_init_does_not_call_http()
test_invalid_revocation_list_raises_service_error()
test_is_signed_token_revoked_returns_false()
test_is_signed_token_revoked_returns_true()
test_memcache()
test_memcache_set_expired(extra_conf={}, extra_environ={})
test_memcache_set_invalid_signed()
test_memcache_set_invalid_uuid()
test_no_memcache_protection(*args, **kwargs)
test_nocatalog()
test_request_blank_token()
test_request_invalid_signed_token()
test_request_invalid_uuid_token()
test_request_no_token()
test_request_no_token_http()
test_request_no_token_log_message()
test_revoked_token_receives_401()
test_sign_cache_data(*args, **kwargs)
test_swift_memcache_set_expired()
test_token_is_v2_accepts_v2()
test_token_is_v2_rejects_v3()
test_token_is_v3_accepts_v3()
test_token_is_v3_rejects_v2()
test_use_cache_from_env()
test_uuid_bind_token_disabled_with_incorrect_ticket()
test_uuid_bind_token_disabled_with_kerb_user()
test_uuid_bind_token_named_kerberos_with_incorrect_ticket()
test_uuid_bind_token_named_kerberos_with_kerb_user()
test_uuid_bind_token_named_kerberos_with_unknown_bind()
test_uuid_bind_token_named_kerberos_without_bind()
test_uuid_bind_token_named_kerberos_without_kerb_user()
test_uuid_bind_token_permissive_with_incorrect_ticket()
test_uuid_bind_token_permissive_with_kerb_user()
test_uuid_bind_token_permissive_with_unknown_bind()
test_uuid_bind_token_permissive_without_kerb_user()
test_uuid_bind_token_required_with_kerb_user()
test_uuid_bind_token_required_with_unknown_bind()
test_uuid_bind_token_required_without_bind()
test_uuid_bind_token_required_without_kerb_user()
test_uuid_bind_token_strict_with_kerb_user()
test_uuid_bind_token_strict_with_kerbout_user()
test_uuid_bind_token_strict_with_unknown_bind()
test_uuid_bind_token_with_unknown_named_FOO()
test_valid_signed_request()
test_valid_uuid_request()
test_valid_uuid_request_with_auth_fragments()
test_verify_signed_token_raises_exception_for_revoked_token()
test_verify_signed_token_succeeds_for_unrevoked_token()
test_verify_signing_dir_create_while_missing()
test_will_expire_soon()
class keystoneclient.tests.test_auth_token_middleware.CrossVersionAuthTokenMiddlewareTest(*args, **kwargs)

Bases: keystoneclient.tests.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, testresources.ResourcedTestCase

resources = [('examples', <testresources.FixtureResource object at 0x6086110>)]
test_valid_uuid_request_forced_to_2_0(*args, **kw)

Test forcing auth_token to use lower api version.

By installing the v3 http hander, auth_token will be get a version list that looks like a v3 server - from which it would normally chose v3.0 as the auth version. However, here we specify v2.0 in the configuration - which should force auth_token to use that version instead.

class keystoneclient.tests.test_auth_token_middleware.DiabloAuthTokenMiddlewareTest(*args, **kwargs)

Bases: keystoneclient.tests.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, testresources.ResourcedTestCase

resources = [('examples', <testresources.FixtureResource object at 0x6086110>)]

Auth Token middleware should understand Diablo keystone responses.

setUp()
test_valid_diablo_response()
class keystoneclient.tests.test_auth_token_middleware.DisableModuleFixture(module, *args, **kw)

Bases: fixtures.fixture.Fixture

A fixture to provide support for unloading/disabling modules.

clear_module()
setUp()

Ensure ImportError for the specified module.

tearDown()
class keystoneclient.tests.test_auth_token_middleware.FakeApp(expected_env=None)

Bases: object

This represents a WSGI app protected by the auth_token middleware.

SUCCESS = 'SUCCESS'
class keystoneclient.tests.test_auth_token_middleware.MultiStepAuthTokenMiddlewareTest(*args, **kwargs)

Bases: keystoneclient.tests.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, testresources.ResourcedTestCase

resources = [('examples', <testresources.FixtureResource object at 0x6086110>)]
test_fetch_revocation_list_with_expire(*args, **kw)
class keystoneclient.tests.test_auth_token_middleware.NoMemcacheAuthToken(*args, **kwargs)

Bases: keystoneclient.tests.test_auth_token_middleware.BaseAuthTokenMiddlewareTest

setUp()
test_multiple_context_managers_share_single_client()
test_nested_context_managers_create_multiple_clients()
test_nomemcache()
test_not_use_cache_from_env()
class keystoneclient.tests.test_auth_token_middleware.NoModuleFinder(module)

Bases: object

Disallow further imports of ‘module’.

find_module(fullname, path)
class keystoneclient.tests.test_auth_token_middleware.TimezoneFixture(new_tz)

Bases: fixtures.fixture.Fixture

cleanup()
setUp()
static supported()
class keystoneclient.tests.test_auth_token_middleware.TokenEncodingTest(*args, **kwargs)

Bases: testtools.testcase.TestCase

test_quoted_token()
test_unquoted_token()
class keystoneclient.tests.test_auth_token_middleware.TokenExpirationTest(*args, **kwargs)

Bases: keystoneclient.tests.test_auth_token_middleware.BaseAuthTokenMiddlewareTest

create_v2_token_fixture(expires=None)
create_v3_token_fixture(expires=None)
setUp()
test_bad_data()
test_cached_token_expired()
test_cached_token_not_expired()
test_cached_token_not_expired_with_old_style_nix_timestamp()

Ensure we cannot retrieve a token from the cache.

Getting a token from the cache should return None when the token data in the cache stores the expires time as a *nix style timestamp.

test_cached_token_with_timezone_offset_expired()
test_cached_token_with_timezone_offset_not_expired()
test_no_data()
test_v2_token_expired()
test_v2_token_not_expired()
test_v2_token_with_timezone_offset_expired(*args, **keywargs)
test_v2_token_with_timezone_offset_not_expired(*args, **keywargs)
test_v3_token_expired()
test_v3_token_not_expired()
test_v3_token_with_timezone_offset_expired(*args, **keywargs)
test_v3_token_with_timezone_offset_not_expired(*args, **keywargs)
class keystoneclient.tests.test_auth_token_middleware.V2CertDownloadMiddlewareTest(*args, **kwargs)

Bases: keystoneclient.tests.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, testresources.ResourcedTestCase

resources = [('examples', <testresources.FixtureResource object at 0x6086110>)]
setUp()
test_fetch_signing_ca()
test_fetch_signing_cert()
test_prefix_trailing_slash()
test_request_no_token_dummy()
test_without_prefix()
class keystoneclient.tests.test_auth_token_middleware.V3CertDownloadMiddlewareTest(*args, **kwargs)

Bases: keystoneclient.tests.test_auth_token_middleware.V2CertDownloadMiddlewareTest

keystoneclient.tests.test_auth_token_middleware.cleanup_revoked_file(filename)
keystoneclient.tests.test_auth_token_middleware.load_tests(loader, tests, pattern)
keystoneclient.tests.test_auth_token_middleware.memcached_available()

Do a sanity check against memcached.

Returns True if the following conditions are met (otherwise, returns False):

  • python-memcached is installed
  • a usable memcached instance is available via MEMCACHED_SERVERS
  • the client is able to set and get a key/value pair
keystoneclient.tests.test_auth_token_middleware.network_error_response(method, uri, headers)
class keystoneclient.tests.test_auth_token_middleware.v2AuthTokenMiddlewareTest(*args, **kwargs)

Bases: keystoneclient.tests.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, keystoneclient.tests.test_auth_token_middleware.CommonAuthTokenMiddlewareTest, testresources.ResourcedTestCase

v2 token specific tests.

There are some differences between how the auth-token middleware handles v2 and v3 tokens over and above the token formats, namely:

  • A v3 keystone server will auto scope a token to a user’s default project if no scope is specified. A v2 server assumes that the auth-token middleware will do that.
  • A v2 keystone server may issue a token without a catalog, even with a tenant

The tests below were originally part of the generic AuthTokenMiddlewareTest class, but now, since they really are v2 specifc, they are included here.

assert_unscoped_default_tenant_auto_scopes(token)

Unscoped v2 requests with a default tenant should “auto-scope.”

The implied scope is the user’s tenant ID.

assert_unscoped_token_receives_401(token)

Unscoped requests with no default tenant ID should be rejected.

assert_valid_last_url(token_id)
resources = [('examples', <testresources.FixtureResource object at 0x6086110>)]
setUp()
test_default_tenant_signed_token()
test_default_tenant_uuid_token()
test_request_prevent_service_catalog_injection()
test_unscoped_pki_token_receives_401()
test_unscoped_uuid_token_receives_401()
class keystoneclient.tests.test_auth_token_middleware.v3AuthTokenMiddlewareTest(*args, **kwargs)

Bases: keystoneclient.tests.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, keystoneclient.tests.test_auth_token_middleware.CommonAuthTokenMiddlewareTest, testresources.ResourcedTestCase

Test auth_token middleware with v3 tokens.

Re-execute the AuthTokenMiddlewareTest class tests, but with the the auth_token middleware configured to expect v3 tokens back from a keystone server.

This is done by configuring the AuthTokenMiddlewareTest class via its Setup(), passing in v3 style data that will then be used by the tests themselves. This approach has been used to ensure we really are running the same tests for both v2 and v3 tokens.

There a few additional specific test for v3 only:

  • We allow an unscoped token to be validated (as unscoped), where as for v2 tokens, the auth_token middleware is expected to try and auto-scope it (and fail if there is no default tenant)
  • Domain scoped tokens

Since we don’t specify an auth version for auth_token to use, by definition we are thefore implicitely testing that it will use the highest available auth version, i.e. v3.0

assert_valid_last_url(token_id)
resources = [('examples', <testresources.FixtureResource object at 0x6086110>)]
setUp()
test_domain_scoped_uuid_request()
test_valid_unscoped_uuid_request()
token_response(request, uri, headers)
class keystoneclient.tests.test_auth_token_middleware.v3FakeApp(expected_env=None)

Bases: keystoneclient.tests.test_auth_token_middleware.FakeApp

This represents a v3 WSGI app protected by the auth_token middleware.

test_base Module

class keystoneclient.tests.test_base.BaseTest(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase

test_eq()
test_getid()
test_human_id()
test_resource_lazy_getattr()
test_resource_repr()
class keystoneclient.tests.test_base.HumanReadable(manager, info, loaded=False)

Bases: keystoneclient.base.Resource

HUMAN_ID = True
class keystoneclient.tests.test_base.ManagerTest(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase

body = {'hello': {'hi': 1}}
setUp()
test_api()
test_get()
test_patch()
test_post()
test_put()
test_update()
url = '/test-url'

test_cms Module

class keystoneclient.tests.test_cms.CMSTest(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase, testresources.ResourcedTestCase

Unit tests for the keystoneclient.common.cms module.

resources = [('examples', <testresources.FixtureResource object at 0x6086110>)]
test_asn1_token()
test_cms_hash_token_default_md5()

The default hash method is md5.

test_cms_hash_token_no_token_id()
test_cms_hash_token_not_pki()

If the token_id is not a PKI token then it returns the token_id.

test_cms_hash_token_sha256()

Can also hash with sha256.

test_cms_sign_token_no_files()
test_cms_sign_token_success()
test_cms_verify()
test_cms_verify_token_no_files()
test_cms_verify_token_no_oserror()
test_cms_verify_token_scoped()
test_cms_verify_token_scoped_expired()
test_cms_verify_token_unscoped()
test_cms_verify_token_v3_scoped()
test_token_to_cms_to_token()
keystoneclient.tests.test_cms.load_tests(loader, tests, pattern)

test_discovery Module

class keystoneclient.tests.test_discovery.AvailableVersionsTests(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase

test_available_cinder_data(*args, **kw)
test_available_glance_data(*args, **kw)
test_available_keystone_data(*args, **kw)
test_available_versions_basics(*args, **kw)
test_available_versions_individual(*args, **kw)
class keystoneclient.tests.test_discovery.ClientDiscoveryTests(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase

assertCreatesV2(**kwargs)
assertCreatesV3(**kwargs)
assertDiscoveryFailure(**kwargs)
assertVersionNotAvailable(**kwargs)
test_bad_response(*args, **kw)
test_discover_200_response_fails(*args, **kw)
test_discover_bad_args(*args, **kw)
test_discover_bad_response(*args, **kw)
test_discover_endpoint_v2(*args, **kw)
test_discover_endpoint_v3(*args, **kw)
test_discover_fail_to_create_bad_individual_version(*args, **kw)
test_discover_forwards_original_ip(*args, **kw)
test_discover_individual_endpoint_v2(*args, **kw)
test_discover_individual_endpoint_v3(*args, **kw)
test_discover_individual_version_v2(*args, **kw)
test_discover_individual_version_v3(*args, **kw)
test_discover_invalid_major_version(*args, **kw)
test_discover_minor_greater_than_available_fails(*args, **kw)
test_discover_unstable_versions(*args, **kw)
test_discover_v2(*args, **kw)
test_discover_v3(*args, **kw)
test_discovery_ignore_invalid(*args, **kw)
test_greater_version_than_required(*args, **kw)
test_ignore_entry_without_links(*args, **kw)
test_ignore_entry_without_status(*args, **kw)
test_lesser_version_than_required(*args, **kw)
test_overriding_stored_kwargs(*args, **kw)
test_pass_client_arguments(*args, **kw)
class keystoneclient.tests.test_discovery.DiscoverUtils(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase

test_keystone_version_objects()
test_version_number()

test_ec2utils Module

class keystoneclient.tests.test_ec2utils.Ec2SignerTest(*args, **kwargs)

Bases: testtools.testcase.TestCase

setUp()
test_generate_0()

Test generate function for v0 signature.

test_generate_1()

Test generate function for v1 signature.

test_generate_v2_SHA1()

Test generate function for v2 signature, SHA1.

test_generate_v2_SHA256()

Test generate function for v2 signature, SHA256.

test_generate_v4()

Test v4 generator with data from AWS docs example.

see: http://docs.aws.amazon.com/general/latest/gr/ sigv4-create-canonical-request.html and http://docs.aws.amazon.com/general/latest/gr/ sigv4-signed-request-examples.html

test_generate_v4_port()

Test v4 generator with host:port format.

test_generate_v4_port_nostrip()

Test v4 generator with host:port format, but for an new (>=2.9.3) version of boto, where the port should not be stripped.

test_generate_v4_port_strip()

Test v4 generator with host:port format, but for an old (<2.9.3) version of boto, where the port should be stripped to match boto behavior.

test_v4_creds_false()
test_v4_creds_header()
test_v4_creds_param()

test_http Module

class keystoneclient.tests.test_http.BasicRequestTests(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase

request(method='GET', response='Test Response', status=200, url=None, **kwargs)
setUp()
test_basic_params(*args, **kw)
test_body(*args, **kw)
test_headers(*args, **kw)
url = 'http://keystone.test.com/'
class keystoneclient.tests.test_http.ClientTest(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase

TEST_URL = 'http://127.0.0.1:5000/hi'
test_client_deprecated()
test_forwarded_for(*args, **kw)
test_get(*args, **kw)
test_get_error_with_json_resp(*args, **kw)
test_get_error_with_plaintext_resp(*args, **kw)
test_post(*args, **kw)
test_unauthorized_client_requests()
class keystoneclient.tests.test_http.FakeLog

Bases: object

debug(msg=None, *args, **kwargs)
warn(msg=None, *args, **kwargs)
keystoneclient.tests.test_http.get_authed_client()
keystoneclient.tests.test_http.get_client()

test_https Module

class keystoneclient.tests.test_https.ClientTest(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase

setUp()
test_get(*args, **keywargs)
test_post(*args, **keywargs)
test_post_auth(*args, **keywargs)
keystoneclient.tests.test_https.get_authed_client()
keystoneclient.tests.test_https.get_client()

test_keyring Module

class keystoneclient.tests.test_keyring.KeyringTest(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase

setUp()
test_build_keyring_key()
test_get_keyring()
test_no_keyring_key()

Ensure that if we don’t have use_keyring set in the client that the keyring is never accessed.

test_set_and_get_keyring_expired()
test_set_keyring()

test_memcache_crypt Module

class keystoneclient.tests.test_memcache_crypt.MemcacheCryptPositiveTests(*args, **kwargs)

Bases: testtools.testcase.TestCase

test_constant_time_compare()
test_derive_keys()
test_encryption()
test_key_strategy_diff()
test_no_pycrypt()
test_protect_wrappers()
test_sign_data()

test_s3_token_middleware Module

class keystoneclient.tests.test_s3_token_middleware.FakeApp

Bases: object

This represents a WSGI app protected by the auth_token middleware.

class keystoneclient.tests.test_s3_token_middleware.S3TokenMiddlewareTestBad(*args, **kwargs)

Bases: keystoneclient.tests.test_s3_token_middleware.S3TokenMiddlewareTestBase

setUp()
test_bad_reply()
test_bogus_authorization()
test_fail_to_connect_to_keystone()
test_unauthorized_token()
class keystoneclient.tests.test_s3_token_middleware.S3TokenMiddlewareTestBase(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase

TEST_HOST = 'fakehost'
TEST_PORT = 35357
TEST_PROTOCOL = 'https'
TEST_URL = 'https://fakehost:35357/v2.0/s3tokens'
setUp()
start_fake_response(status, headers)
class keystoneclient.tests.test_s3_token_middleware.S3TokenMiddlewareTestGood(*args, **kwargs)

Bases: keystoneclient.tests.test_s3_token_middleware.S3TokenMiddlewareTestBase

setUp()
test_authorization_nova_toconnect()
test_authorized()
test_authorized_http()
test_insecure(*args, **keywargs)
test_no_path_request()
test_without_auth_storage_token()
test_without_authorization()
class keystoneclient.tests.test_s3_token_middleware.S3TokenMiddlewareTestUtil(*args, **kwargs)

Bases: testtools.testcase.TestCase

test_split_path_failed()
test_split_path_invalid_path()
test_split_path_success()

test_session Module

class keystoneclient.tests.test_session.AuthPlugin(token='aToken')

Bases: keystoneclient.auth.base.BaseAuthPlugin

Very simple debug authentication plugin.

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

SERVICE_URLS = {'image': {'admin': 'http://image-admin:3333/v2.0', 'public': 'http://image-public:3333/v2.0'}, 'compute': {'admin': 'http://compute-admin:2222/v1.0', 'public': 'http://compute-public:2222/v1.0'}, 'identity': {'admin': 'http://identity-admin:1111/v2.0', 'public': 'http://identity-public:1111/v2.0'}}
TEST_TOKEN = 'aToken'
get_endpoint(session, service_type=None, interface=None, **kwargs)
get_token(session)
class keystoneclient.tests.test_session.CalledAuthPlugin

Bases: keystoneclient.auth.base.BaseAuthPlugin

ENDPOINT = 'http://fakeendpoint/'
get_endpoint(session, **kwargs)
get_token(session)
class keystoneclient.tests.test_session.ConstructSessionFromArgsTests(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase

CACERT = 'cacert-path'
CERT = 'certfile'
KEY = 'keyfile'
test_cert()
test_pass_through()
test_verify()
class keystoneclient.tests.test_session.RedirectTests(*args, **kwargs)

Bases: keystoneclient.tests.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=u'GET', status=305, redirect_kwargs={}, final_kwargs={})
test_basic_get(*args, **kw)
test_basic_post_keeps_correct_method(*args, **kw)
test_history_matches_requests(*args, **kw)
test_no_redirect(*args, **kw)
test_redirect_forever(*args, **kw)
test_redirect_limit(*args, **kw)
class keystoneclient.tests.test_session.SessionAuthTests(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase

TEST_JSON = {'hello': 'world'}
TEST_URL = 'http://127.0.0.1:5000/'
stub_service_url(service_type, interface, path, method=u'GET', **kwargs)
test_auth_plugin_default_with_plugin(*args, **kw)
test_auth_plugin_disable(*args, **kw)
test_passed_auth_plugin(*args, **kw)
test_passed_auth_plugin_overrides(*args, **kw)
test_raises_exc_only_when_asked(*args, **kw)
test_requests_auth_plugin()
test_service_type_urls(*args, **kw)
test_service_url_raises_if_no_auth_plugin()
test_service_url_raises_if_no_url_returned()
class keystoneclient.tests.test_session.SessionTests(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase

TEST_URL = 'http://127.0.0.1:5000/'
test_delete(*args, **kw)
test_get(*args, **kw)
test_head(*args, **kw)
test_http_session_opts(*args, **kw)
test_not_found(*args, **kw)
test_patch(*args, **kw)
test_post(*args, **kw)
test_put(*args, **kw)
test_server_error(*args, **kw)
test_session_debug_output(*args, **kw)
test_user_agent(*args, **kw)

test_shell Module

class keystoneclient.tests.test_shell.NoExitArgumentParser(prog=None, usage=None, description=None, epilog=None, version=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True)

Bases: argparse.ArgumentParser

error(message)
class keystoneclient.tests.test_shell.ShellTest(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase

FAKE_ENV = {'OS_PASSWORD': 'password', 'OS_AUTH_URL': 'http://127.0.0.1:5000/v2.0/', 'OS_TENANT_ID': 'tenant_id', 'OS_USERNAME': 'username', 'OS_TENANT_NAME': 'tenant_name'}
setUp()
shell(argstr)
test_auth_no_credentials()
test_auth_password_authurl_no_username()
test_auth_username_password_no_authurl()
test_debug()
test_do_ec2_get()
test_do_endpoints()
test_do_tenant_create()
test_do_tenant_list()
test_do_timeout()
test_endpoint_no_token()
test_help()
test_help_command()
test_help_no_args()
test_help_unknown_command()
test_shell_args()
test_shell_tenant_id_args()

Test a corner case where –tenant_id appears on the command-line twice.

test_shell_user_create_args()

Test user-create args.

test_timeout_parse_invalid_number()
test_timeout_parse_invalid_type()
test_token_no_endpoint()

test_utils Module

class keystoneclient.tests.test_utils.FakeManager

Bases: object

find(name=None)
get(resource_id)
resource_class

alias of FakeResource

resources = {'1234': {'name': 'entity_one'}, '8e8ec658-c7b0-4243-bdf8-6f7f2952c0d0': {'name': 'entity_two'}, '5678': {'name': '9876'}, '\xe3\x82\xbdtest': {'name': u'\u30bdtest'}}
class keystoneclient.tests.test_utils.FakeObject(name)

Bases: object

class keystoneclient.tests.test_utils.FakeResource

Bases: object

class keystoneclient.tests.test_utils.FindResourceTestCase(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase

setUp()
test_find_by_int_name()
test_find_by_integer_id()
test_find_by_str_id()
test_find_by_str_name()
test_find_by_unicode()
test_find_by_uuid()
test_find_no_unique_match()
test_find_none()
class keystoneclient.tests.test_utils.HashSignedTokenTestCase(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase, testresources.ResourcedTestCase

Unit tests for utils.hash_signed_token().

resources = [('examples', <testresources.FixtureResource object at 0x6086110>)]
test_default_md5()

The default hash method is md5.

test_sha256()

Can also hash with sha256.

class keystoneclient.tests.test_utils.PrintTestCase(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase

setUp()
test_print_dict_unicode()
test_print_list_unicode()
class keystoneclient.tests.test_utils.TestPositional(*args, **kwargs)

Bases: keystoneclient.tests.utils.TestCase

classmethod class_method(*args, **kwargs)
inspect_func(*args, **kwargs)
mixed_except(*args, **kwargs)
mixed_warn(*args, **kwargs)
no_vars(*args, **kwargs)
normal_method(*args, **kwargs)
test_class_method()
test_inspect_positions()
test_mixed_except()
test_mixed_warn()
test_normal_method()
test_nothing()
keystoneclient.tests.test_utils.load_tests(loader, tests, pattern)

utils Module

class keystoneclient.tests.utils.TestCase(*args, **kwargs)

Bases: testtools.testcase.TestCase

TEST_DOMAIN_ID = '1'
TEST_DOMAIN_NAME = 'aDomain'
TEST_ROOT_URL = 'http://127.0.0.1:5000/'
TEST_TENANT_ID = '1'
TEST_TENANT_NAME = 'aTenant'
TEST_TOKEN = 'aToken'
TEST_TRUST_ID = 'aTrust'
TEST_USER = 'test'
assertQueryStringContains(**kwargs)
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 and httpretty must have been activated for the request.

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

Bases: requests.models.Response

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

text