diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-11-08 03:45:16 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-11-08 03:45:16 +0000 |
commit | b88f5ddef6e3c7d1ec4d10ac7bbcd1e645a939d6 (patch) | |
tree | 96fa6dbbb7fad2082ea5627cfd8d018ec45eab16 | |
parent | 8bb477382f04115460ae6d473cf4fce0b67f48e4 (diff) | |
parent | b736936e51df4043c5fddc094355584de831185c (diff) | |
download | keystonemiddleware-b88f5ddef6e3c7d1ec4d10ac7bbcd1e645a939d6.tar.gz |
Merge "Mock log only after app creation"
-rw-r--r-- | keystonemiddleware/tests/unit/audit/test_logging_notifier.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/keystonemiddleware/tests/unit/audit/test_logging_notifier.py b/keystonemiddleware/tests/unit/audit/test_logging_notifier.py index f0174ad..0801861 100644 --- a/keystonemiddleware/tests/unit/audit/test_logging_notifier.py +++ b/keystonemiddleware/tests/unit/audit/test_logging_notifier.py @@ -25,15 +25,16 @@ class TestLoggingNotifier(base.BaseAuditMiddlewareTest): super(TestLoggingNotifier, self).setUp() - @mock.patch('keystonemiddleware.audit._LOG.info') - def test_api_request_no_messaging(self, log): - self.create_simple_app().get('/foo/bar', - extra_environ=self.get_environ_header()) - - # Check first notification with only 'request' - call_args = log.call_args_list[0][0] - self.assertEqual('audit.http.request', call_args[1]['event_type']) - - # Check second notification with request + response - call_args = log.call_args_list[1][0] - self.assertEqual('audit.http.response', call_args[1]['event_type']) + def test_api_request_no_messaging(self): + app = self.create_simple_app() + + with mock.patch('keystonemiddleware.audit._LOG.info') as log: + app.get('/foo/bar', extra_environ=self.get_environ_header()) + + # Check first notification with only 'request' + call_args = log.call_args_list[0][0] + self.assertEqual('audit.http.request', call_args[1]['event_type']) + + # Check second notification with request + response + call_args = log.call_args_list[1][0] + self.assertEqual('audit.http.response', call_args[1]['event_type']) |