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: 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: keystonemiddleware.tests.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: keystonemiddleware.tests.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: object
Test Composite authentication.
Test the behaviour of adding a service-token.
Bases: object
Base composite auth object with common service token environment.
Bases: keystonemiddleware.tests.test_auth_token_middleware.CompositeBase, keystonemiddleware.tests.test_auth_token_middleware.FakeApp
A fake v2 WSGI app protected by composite auth_token middleware.
Bases: keystonemiddleware.tests.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: keystonemiddleware.tests.test_auth_token_middleware.BaseAuthTokenMiddlewareTest
Bases: keystonemiddleware.tests.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: keystonemiddleware.tests.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, testresources.ResourcedTestCase
These tests are not affected by the token format (see CommonAuthTokenMiddlewareTest).
Bases: keystonemiddleware.tests.test_auth_token_middleware.BaseAuthTokenMiddlewareTest
These tests will not have the memcache module available.
Bases: fixtures.fixture.Fixture
Bases: testtools.testcase.TestCase
Bases: keystonemiddleware.tests.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: keystonemiddleware.tests.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, testresources.ResourcedTestCase
Bases: keystonemiddleware.tests.test_auth_token_middleware.V2CertDownloadMiddlewareTest
Do a sanity check against memcached.
Returns True if the following conditions are met (otherwise, returns False):
Bases: keystonemiddleware.tests.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, keystonemiddleware.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:
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: keystonemiddleware.tests.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, keystonemiddleware.tests.test_auth_token_middleware.CommonCompositeAuthTests, testresources.ResourcedTestCase
Test auth_token middleware with v2 token based composite auth.
Execute the Composite auth class tests, but with the auth_token middleware configured to expect v2 tokens back from a keystone server.
Bases: keystonemiddleware.tests.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, keystonemiddleware.tests.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: keystonemiddleware.tests.test_auth_token_middleware.BaseAuthTokenMiddlewareTest, keystonemiddleware.tests.test_auth_token_middleware.CommonCompositeAuthTests, testresources.ResourcedTestCase
Test auth_token middleware with v3 token based composite auth.
Execute the Composite auth class tests, but with the auth_token middleware configured to expect v3 tokens back from a keystone server.
Bases: keystonemiddleware.tests.test_auth_token_middleware.CompositeBase, keystonemiddleware.tests.test_auth_token_middleware.v3FakeApp
A fake v3 WSGI app protected by composite auth_token middleware.
Bases: keystonemiddleware.tests.test_auth_token_middleware.FakeApp
This represents a v3 WSGI app protected by the auth_token middleware.
Bases: keystonemiddleware.tests.utils.TestCase
Bases: keystonemiddleware.tests.utils.TestCase
Bases: object
This represents a WSGI app protected by the auth_token middleware.
Bases: keystonemiddleware.tests.test_s3_token_middleware.S3TokenMiddlewareTestBase
Bases: keystonemiddleware.tests.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 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 and httpretty must have been activated for the request.