diff options
author | Mark McLoughlin <markmc@redhat.com> | 2013-05-20 16:53:10 +0100 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2013-05-20 16:55:02 +0100 |
commit | d2e9d98d566d0e3bbf2fdb4526c2fc3228d14c2c (patch) | |
tree | 836121188ceb84befe5d5e7724f8407a8a2ce55d /tests | |
parent | 97bb81ddbcc47343c78e0a6efe724878fcb35ecb (diff) | |
download | oslo-d2e9d98d566d0e3bbf2fdb4526c2fc3228d14c2c.tar.gz oslo-d2e9d98d566d0e3bbf2fdb4526c2fc3228d14c2c.tar.xz oslo-d2e9d98d566d0e3bbf2fdb4526c2fc3228d14c2c.zip |
Use stubout in test_correlation_id
Best to use stubout for stubbing out methods like this. That way they
get properly unstubbed on failure.
Change-Id: I61dc96d01e331e8d811b8f24137e8f738cf09215
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/middleware/test_correlation_id.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/unit/middleware/test_correlation_id.py b/tests/unit/middleware/test_correlation_id.py index 070c23e..dc83cc7 100644 --- a/tests/unit/middleware/test_correlation_id.py +++ b/tests/unit/middleware/test_correlation_id.py @@ -28,14 +28,13 @@ class CorrelationIdMiddlewareTest(utils.BaseTestCase): app = mock.Mock() req = mock.Mock() req.headers = {} - original_method = uuidutils.generate_uuid + mock_generate_uuid = mock.Mock() mock_generate_uuid.return_value = "fake_uuid" - uuidutils.generate_uuid = mock_generate_uuid + self.stubs.Set(uuidutils, 'generate_uuid', mock_generate_uuid) middleware = correlation_id.CorrelationIdMiddleware(app) middleware(req) - uuidutils.generate_uuid = original_method self.assertEquals(req.headers.get("X_CORRELATION_ID"), "fake_uuid") |