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:53:10 +0100 |
commit | 3ab22c9a98f64e5093066efb6033f4ae5676a2bb (patch) | |
tree | c40c8c6dd54c6eaf7e206ef6d2a6a3c40fccd022 | |
parent | 758263a8fba5870f48d2e8d15a13bf383eb389d2 (diff) | |
download | oslo-middleware-3ab22c9a98f64e5093066efb6033f4ae5676a2bb.tar.gz |
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
-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") |