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:
(see http://docs.python.org/2/library/unittest.html#load-tests-protocol )
Bases: fixtures.fixture.Fixture
A fixture to house the various code examples for the keystoneclient hacking style checks.
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.
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.
Bases: keystoneclient.tests.unit.test_auth_token_middleware.BaseAuthTokenMiddlewareTest
If swift.cache is set in the environment but cache isn’t set in the config then the env cache isn’t used.
If swift.cache is set in the environment and cache is set in the config then the env cache is used.
Bases: keystoneclient.tests.unit.test_auth_token_middleware.BaseAuthTokenMiddlewareTest
Bases: object
These tests are run once using v2 tokens and again using v3 tokens.
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.
Bases: keystoneclient.tests.unit.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, testresources.ResourcedTestCase
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.
Bases: keystoneclient.tests.unit.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, testresources.ResourcedTestCase
Auth Token middleware should understand Diablo keystone responses.
Bases: object
This represents a WSGI app protected by the auth_token middleware.
Bases: keystoneclient.tests.unit.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, testresources.ResourcedTestCase
These tests are not affected by the token format (see CommonAuthTokenMiddlewareTest).
Bases: keystoneclient.tests.unit.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, testresources.ResourcedTestCase
Bases: keystoneclient.tests.unit.test_auth_token_middleware.BaseAuthTokenMiddlewareTest
These tests will not have the memcache module available.
Bases: fixtures.fixture.Fixture
Bases: fixtures.fixture.Fixture
Bases: testtools.testcase.TestCase
Bases: keystoneclient.tests.unit.test_auth_token_middleware.BaseAuthTokenMiddlewareTest
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.
Bases: keystoneclient.tests.unit.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, testresources.ResourcedTestCase
Bases: keystoneclient.tests.unit.test_auth_token_middleware.V2CertDownloadMiddlewareTest
Do a sanity check against memcached.
Returns True if the following conditions are met (otherwise, returns False):
Bases: keystoneclient.tests.unit.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, keystoneclient.tests.unit.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:
The tests below were originally part of the generic AuthTokenMiddlewareTest class, but now, since they really are v2 specific, they are included here.
Unscoped v2 requests with a default tenant should “auto-scope.”
The implied scope is the user’s tenant ID.
Unscoped requests with no default tenant ID should be rejected.
Bases: keystoneclient.tests.unit.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, keystoneclient.tests.unit.test_auth_token_middleware.CommonAuthTokenMiddlewareTest, testresources.ResourcedTestCase
Test auth_token middleware with v3 tokens.
Re-execute the AuthTokenMiddlewareTest class tests, but with 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:
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
Bases: keystoneclient.tests.unit.test_auth_token_middleware.FakeApp
This represents a v3 WSGI app protected by the auth_token middleware.
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: keystoneclient.base.Resource
Bases: keystoneclient.tests.unit.utils.TestCase, testresources.ResourcedTestCase
Unit tests for the keystoneclient.common.cms module.
The default hash method is md5.
If the token_id is not a PKI token then it returns the token_id.
Can also hash with sha256.
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: testtools.testcase.TestCase
Test generate function for v0 signature.
Test generate function for v1 signature.
Test generate function for v2 signature, SHA1.
Test generate function for v2 signature, SHA256.
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 v4 generator with host:port format.
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 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.
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: object
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: keystoneclient.tests.unit.utils.TestCase
Ensure that if we don’t have use_keyring set in the client that the keyring is never accessed.
Bases: object
This represents a WSGI app protected by the auth_token middleware.
Bases: keystoneclient.tests.unit.test_s3_token_middleware.S3TokenMiddlewareTestBase
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: keystoneclient.auth.base.BaseAuthPlugin
Very simple debug authentication plugin.
Takes Parameters such that it can throw exceptions at the right times.
Bases: keystoneclient.auth.base.BaseAuthPlugin
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: keystoneclient.tests.unit.utils.TestCase
Test request and response headers in debug logs
in order to redact secure headers while debug is true.
Bases: argparse.ArgumentParser
Bases: keystoneclient.tests.unit.utils.TestCase
Test a corner case where –tenant_id appears on the command-line twice.
Test user-create args.
Bases: object
alias of FakeResource
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: keystoneclient.tests.unit.utils.TestCase, testresources.ResourcedTestCase
Unit tests for utils.hash_signed_token().
The default hash method is md5.
Can also hash with sha256.
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: keystoneclient.tests.unit.utils.TestCase
Bases: fixtures.fixture.Fixture
A fixture to provide support for unloading/disabling modules.
Ensure ImportError for the specified module.
Bases: object
Disallow further imports of ‘module’.
Bases: testtools.testcase.TestCase
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.
Verify the QueryString matches what is expected.
The qs parameter should be of the format ‘foo=bar&abc=xyz’
Verify that the last request made contains a header and its value
The request must have already been made.