@mock.patch('st2common.logging.formatters.MASKED_ATTRIBUTES_BLACKLIST', MOCK_MASKED_ATTRIBUTES_BLACKLIST)
def test_format_blacklisted_attributes_are_masked(self):
    formatter = ConsoleLogFormatter()
    mock_message = 'test message 1'
    record = MockRecord()
    record.msg = mock_message
    record._blacklisted_1 = 'test value 1'
    record._blacklisted_2 = 'test value 2'
    record._blacklisted_3 = {'key1': 'val1', 'blacklisted_1': 'val2', 'key3': 'val3'}
    record._foo1 = 'bar'
    message = formatter.format(record=record)
    expected = "test message 1 (blacklisted_1='********',blacklisted_2='********',blacklisted_3={'key3': 'val3', 'key1': 'val1', 'blacklisted_1': '********'},foo1='bar')"
    self.assertEqual(sorted(message), sorted(expected))
@mock.patch('st2common.logging.formatters.MASKED_ATTRIBUTES_BLACKLIST', MOCK_MASKED_ATTRIBUTES_BLACKLIST)
def test_format_blacklisted_attributes_are_masked(self):
    formatter = ConsoleLogFormatter()
    mock_message = 'test message 1'
    record = MockRecord()
    record.msg = mock_message
    record._blacklisted_1 = 'test value 1'
    record._blacklisted_2 = 'test value 2'
    record._blacklisted_3 = {'key1': 'val1', 'blacklisted_1': 'val2', 'key3': 'val3'}
    record._foo1 = 'bar'
    message = formatter.format(record=record)
    expected = "test message 1 (blacklisted_1='********',blacklisted_2='********',blacklisted_3={'key3': 'val3', 'key1': 'val1', 'blacklisted_1': '********'},foo1='bar')"
    self.assertEqual(sorted(message), sorted(expected))