Beispiel #1
0
    def test_log_create_note(self):
        self.assertEqual(0, Log.objects.count())

        note = NoteFactory.create(_signal=self.signal)
        SignalLogService.log_create_note(note)

        self.assertSignalsNotInLog(self.signals_no_log)

        self.assertEqual(1, Log.objects.count())
        self.assertEqual(1, self.signal.history_log.count())
        self.assertEqual(
            0,
            self.signal.history_log.exclude(action=Log.ACTION_CREATE).count())
        self.assertEqual(
            1,
            self.signal.history_log.filter(action=Log.ACTION_CREATE).count())
        self.assertEqual(1, note.history_log.count())
Beispiel #2
0
def create_note_handler(sender, instance, *args, **kwargs):
    """
    Create a log rule
    """
    SignalLogService.log_create_note(instance)