コード例 #1
0
ファイル: test_formatters.py プロジェクト: openstack/oslo.log
 def test_dictify_context_without_get_logging_values(self, mock_deprecate):
     ctxt = AlternativeRequestContext(user="******", tenant="tenant")
     d = {"user": "******", "tenant": "tenant"}
     self.assertEqual(d, formatters._dictify_context(ctxt))
     mock_deprecate.assert_called_with(
         'The RequestContext.get_logging_values() '
         'method should be defined for logging context specific '
         'information.  The to_dict() method is deprecated '
         'for oslo.log use.', removal_version='5.0.0', version='3.8.0')
コード例 #2
0
 def test_dictify_context_without_get_logging_values(self, mock_deprecate):
     ctxt = AlternativeRequestContext(user="******", tenant="tenant")
     d = {"user": "******", "tenant": "tenant"}
     self.assertEqual(d, formatters._dictify_context(ctxt))
     mock_deprecate.assert_called_with(
         'The RequestContext.get_logging_values() '
         'method should be defined for logging context specific '
         'information.  The to_dict() method is deprecated '
         'for oslo.log use.',
         removal_version='5.0.0',
         version='3.8.0')
コード例 #3
0
 def test_dictify_context_with_context(self, mock_deprecate):
     ctxt = _fake_context()
     self.assertEqual(ctxt.get_logging_values(),
                      formatters._dictify_context(ctxt))
     mock_deprecate.assert_not_called()
コード例 #4
0
 def test_dictify_context_with_dict(self, mock_deprecate):
     d = {"user": "******"}
     self.assertEqual(d, formatters._dictify_context(d))
     mock_deprecate.assert_not_called()
コード例 #5
0
 def test_dictify_context_empty(self):
     self.assertEqual({}, formatters._dictify_context(None))
コード例 #6
0
ファイル: test_formatters.py プロジェクト: openstack/oslo.log
 def test_dictify_context_with_context(self, mock_deprecate):
     ctxt = _fake_context()
     self.assertEqual(ctxt.get_logging_values(),
                      formatters._dictify_context(ctxt))
     mock_deprecate.assert_not_called()
コード例 #7
0
ファイル: test_formatters.py プロジェクト: openstack/oslo.log
 def test_dictify_context_with_dict(self, mock_deprecate):
     d = {"user": "******"}
     self.assertEqual(d, formatters._dictify_context(d))
     mock_deprecate.assert_not_called()
コード例 #8
0
ファイル: test_formatters.py プロジェクト: openstack/oslo.log
 def test_dictify_context_empty(self):
     self.assertEqual({}, formatters._dictify_context(None))