예제 #1
0
    def test_read_at(self):
        from sequere.contrib.timeline import Timeline

        timeline = Timeline(self.user)
        timeline.mark_as_read()

        self.assertTrue(timeline.read_at is not None)
예제 #2
0
    def test_read_at(self):
        from sequere.contrib.timeline import Timeline

        timeline = Timeline(self.user)
        timeline.mark_as_read()

        self.assertTrue(timeline.read_at is not None)
예제 #3
0
    def test_dispatch_action(self):
        from ..models import (follow, unfollow)
        from .sequere_registry import JoinAction, LikeAction, Project
        from sequere.contrib.timeline import Timeline

        follow(self.newbie, self.user)

        timeline = Timeline(self.user)

        action = JoinAction(self.user)

        timeline.save(action)

        timeline = Timeline(self.newbie)

        self.assertEqual(timeline.get_private_count(), 1)
        self.assertEqual(timeline.get_public_count(), 0)

        unfollow(self.newbie, self.user)

        action = LikeAction(actor=self.user, target=self.project)
        timeline = Timeline(self.user)

        timeline.save(action)

        self.assertEqual(timeline.get_private_count(), 2)
        self.assertEqual(timeline.get_public_count(), 2)

        self.assertEqual(timeline.get_private_count(target=Project), 1)
        self.assertEqual(timeline.get_public_count(target=Project), 1)

        timeline = Timeline(self.newbie)

        self.assertEqual(timeline.get_private_count(), 0)
        self.assertEqual(timeline.get_unread_count(), 0)

        timeline.mark_as_read(timestamp=datetime.now() + timedelta(days=1))

        self.assertEqual(timeline.get_unread_count(), 0)

        self.assertEqual(timeline.get_public_count(), 0)
예제 #4
0
    def test_dispatch_action(self):
        from ..models import (follow, unfollow)
        from .sequere_registry import JoinAction, LikeAction, Project
        from sequere.contrib.timeline import Timeline

        follow(self.newbie, self.user)

        timeline = Timeline(self.user)

        action = JoinAction(self.user)

        timeline.save(action)

        timeline = Timeline(self.newbie)

        self.assertEqual(timeline.get_private_count(), 1)
        self.assertEqual(timeline.get_public_count(), 0)

        unfollow(self.newbie, self.user)

        action = LikeAction(actor=self.user, target=self.project)
        timeline = Timeline(self.user)

        timeline.save(action)

        self.assertEqual(timeline.get_private_count(), 2)
        self.assertEqual(timeline.get_public_count(), 2)

        self.assertEqual(timeline.get_private_count(target=Project), 1)
        self.assertEqual(timeline.get_public_count(target=Project), 1)

        timeline = Timeline(self.newbie)

        self.assertEqual(timeline.get_private_count(), 0)
        self.assertEqual(timeline.get_unread_count(), 0)

        timeline.mark_as_read(timestamp=datetime.now() + timedelta(days=1))

        self.assertEqual(timeline.get_unread_count(), 0)

        self.assertEqual(timeline.get_public_count(), 0)