def test_audit_log_call(self):
account_user = User(username="alice")
request_user = User(username="bob")
request = RequestFactory().get("/")
# create a log
audit = {}
audit_log(Actions.FORM_PUBLISHED, request_user, account_user,
"Form published", audit, request)
# function should just run without exception so we are good at this
# point query for this log entry
sort = {"created_on": -1}
cursor = AuditLog.query_mongo(
account_user.username, None, None, sort, 0, 1)
self.assertTrue(cursor.count() > 0)
record = cursor.next()
self.assertEqual(record['account'], "alice")
self.assertEqual(record['user'], "bob")
self.assertEqual(record['action'], Actions.FORM_PUBLISHED)
评论列表
文章目录