Files
edx-platform/lms/djangoapps/commerce/tests/test_utils.py
Renzo Lucioni d330831871 Improve logging of ecommerce interactions
Adds standardized audit logging for checkout and enrollment change requests. XCOM-427.
2015-06-30 17:34:16 -04:00

19 lines
636 B
Python

"""Tests of commerce utilities."""
from django.test import TestCase
from mock import patch
from commerce.utils import audit_log
class AuditLogTests(TestCase):
"""Tests of the commerce audit logging helper."""
@patch('commerce.utils.log')
def test_log_message(self, mock_log):
"""Verify that log messages are constructed correctly."""
audit_log('foo', qux='quux', bar='baz')
# Verify that the logged message contains comma-separated
# key-value pairs ordered alphabetically by key.
message = 'foo: bar="baz", qux="quux"'
self.assertTrue(mock_log.info.called_with(message))