Ejemplo n.º 1
0
def load_events():
    evt = Event.create( 'mef', 'Hai la mare', 'La mare', timezone.now() )
    create_event_notification(evt)
    evt = Event.create( 'mef', 'Hai la munte', 'La munte', timezone.now() )
    create_event_notification(evt)
    evt = Event.create( 'ref', 'Munte si mare in aceeasi zi', 'La mare si la munte', timezone.now() )
    create_event_notification(evt)
    evt = Event.create( 'ref', 'Munte si mare in alta zi', 'La mare si la munte', timezone.now() )
    create_event_notification(evt)
Ejemplo n.º 2
0
    def test_double_attending(self):
        event = Event.create('user1', 'Test event', 'Here', timezone.now())
        user2 = User.objects.get(username='******')
        user3 = User.objects.get(username='******')
        try:
            EventAttending.objects.create(user=user2, event=event)
        except IntegrityError:
            pass

        self.assertTrue(EventAttending.objects.is_user_attending(user2, event))
        self.assertFalse(EventAttending.objects.is_user_attending(user3, event))
        event.delete()
Ejemplo n.º 3
0
    def test_event_notifications(self):
        """
        Test adding an event notification
        """
        evt = Event.create("user1", "Event Title 1", "Location of the event 1", timezone.now())
        create_event_notification(evt)

        evt = Event.create("user1", "Event Title 2", "Location of the event 2", timezone.now())
        create_event_notification(evt)

        evt = Event.create("user1", "Event Title 3", "Location of the event 3", timezone.now())
        create_event_notification(evt)

        time.sleep(30)

        notifications = ActionNotification.objects.all()

        for n in notifications:
            print n.get_text()

        user2 = User.objects.get(username = '******')
        notifications = get_notifications_for_user(user2)
        self.assertTrue( notifications.count() == 3)