summaryrefslogtreecommitdiff
path: root/keystonemiddleware/tests/unit/auth_token
diff options
context:
space:
mode:
authorJamie Lennox <jamielennox@gmail.com>2016-07-04 11:31:28 +1000
committerSteve Martinelli <s.martinelli@gmail.com>2016-09-30 05:45:18 +0000
commit6a5ef484f2c1767fc332461eb13b3c44fa799c59 (patch)
tree24f4ba2b1be1e7beef565a6c331416398d475444 /keystonemiddleware/tests/unit/auth_token
parent98b639aeb7c2721ec3d4a09e695d7732541b8322 (diff)
downloadkeystonemiddleware-6a5ef484f2c1767fc332461eb13b3c44fa799c59.tar.gz
Refactor audit tests to use create_middleware
The auth_token tests have a good layout for using create_middleware and create_simple_middleware that makes it easy for tests to create middleware for testing as required rather than having a self.middleware object that gets overriden a lot. Extract this create_middleware into a base class and implement it in audit so the patterns are similar. Change-Id: I2f050eef1684c8046f94dc2b88b4c97a56ea9cd8
Diffstat (limited to 'keystonemiddleware/tests/unit/auth_token')
-rw-r--r--keystonemiddleware/tests/unit/auth_token/base.py14
1 files changed, 1 insertions, 13 deletions
diff --git a/keystonemiddleware/tests/unit/auth_token/base.py b/keystonemiddleware/tests/unit/auth_token/base.py
index 06115ce..1ff4816 100644
--- a/keystonemiddleware/tests/unit/auth_token/base.py
+++ b/keystonemiddleware/tests/unit/auth_token/base.py
@@ -24,7 +24,7 @@ from keystonemiddleware import auth_token
from keystonemiddleware.tests.unit import utils
-class BaseAuthTokenTestCase(utils.BaseTestCase):
+class BaseAuthTokenTestCase(utils.MiddlewareTestCase):
def setUp(self):
super(BaseAuthTokenTestCase, self).setUp()
@@ -49,18 +49,6 @@ class BaseAuthTokenTestCase(utils.BaseTestCase):
return auth_token.AuthProtocol(_do_cb, opts)
- def create_simple_middleware(self,
- status='200 OK',
- body='',
- headers=None,
- **kwargs):
- def cb(req):
- resp = webob.Response(body, status)
- resp.headers.update(headers or {})
- return resp
-
- return self.create_middleware(cb, **kwargs)
-
def call(self, middleware, method='GET', path='/', headers=None,
expected_status=http_client.OK):
req = webob.Request.blank(path)