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')
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')
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()
def test_dictify_context_with_dict(self, mock_deprecate): d = {"user": "******"} self.assertEqual(d, formatters._dictify_context(d)) mock_deprecate.assert_not_called()
def test_dictify_context_empty(self): self.assertEqual({}, formatters._dictify_context(None))
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()
def test_dictify_context_with_dict(self, mock_deprecate): d = {"user": "******"} self.assertEqual(d, formatters._dictify_context(d)) mock_deprecate.assert_not_called()
def test_dictify_context_empty(self): self.assertEqual({}, formatters._dictify_context(None))