Esempio n. 1
0
    def test_05_event_finished(self):
        now = tz_now().replace(microsecond=0) - datetime.timedelta(minutes=20)
        end = now + datetime.timedelta(minutes=10)
        event = self._create_event(now, end)

        cron_social_network()
        self.assertEqual(SnEvent.objects.count(), 0)
Esempio n. 2
0
 def test_04_event_started_without_end(self):
     now = tz_now().replace(microsecond=0) - datetime.timedelta(minutes=10)
     event = self._create_event(now)
     cron_social_network()
     self.assertEqual(SnEvent.objects.count(), 1)
     sn_event = SnEvent.objects.get(id=1)
     self.assertEqual(sn_event.event, event)
     self.assertEqual(sn_event.name, MockSN.name)
     self.assertEqual(sn_event.sn_id, '1')
Esempio n. 3
0
    def test_07_eventlog_future(self):
        now = tz_now().replace(microsecond=0) - datetime.timedelta(minutes=10)
        end = now + datetime.timedelta(minutes=20)
        eventlog = self._create_eventlog(now, end)

        eventlog.date = end
        eventlog.save()
        SnEventLog.objects.all().delete()

        cron_social_network()
        self.assertEqual(SnEventLog.objects.count(), 0)
Esempio n. 4
0
    def test_06_eventlog_default(self):
        now = tz_now().replace(microsecond=0) - datetime.timedelta(minutes=10)
        end = now + datetime.timedelta(minutes=20)
        eventlog = self._create_eventlog(now, end)

        cron_social_network()
        self.assertEqual(SnEventLog.objects.count(), 1)
        sn_eventlog = SnEventLog.objects.get(id=1)
        self.assertEqual(sn_eventlog.eventlog, eventlog)
        self.assertEqual(sn_eventlog.name, MockSN.name)
        self.assertEqual(sn_eventlog.sn_id, '1')
Esempio n. 5
0
 def test_02_event_not_started_without_end(self):
     now = tz_now().replace(microsecond=0) + datetime.timedelta(minutes=10)
     event = self._create_event(now)
     cron_social_network()
     self.assertEqual(SnEvent.objects.count(), 0)