def test_masquerade_end_callback(self):
     signals.masquerade_end_callback(sender=self, request=self.request, user=self.user_1, masquerade_as=self.user_2)
     audit_log_event = UnitTestAuditLogEvent.objects.get()
     self.assertEqual(audit_log_event.user_id, 1)
     self.assertEqual(audit_log_event.user_email, '*****@*****.**')
     self.assertEqual(audit_log_event.company_id, 1)
     self.assertIsNone(audit_log_event.masquerading_user_id)
     self.assertEqual(audit_log_event.masquerading_user_email, '')
     self.assertEqual(audit_log_event.message, 'Masquerade end as [email protected] (2)')
 def test_masquerade_end_callback_no_audit_log(self):
     signals.masquerade_end_callback(sender=self, request=self.request, user=self.user_1, masquerade_as=self.user_2)
     self.assertEqual(0, UnitTestAuditLogEvent.objects.count())