class TrashFeedsTests(TestCase):

    def setUp(self):
        two_hours = timedelta(hours=2)
        time_invalidated = datetime.now() - two_hours
        self.feed = InvalidFeedFactory(trashed_at=time_invalidated)

    def teardown(self):
        pass

    def test_trashing_invalid_feeds_works(self):
        assert_equals(Feed.trashed.count(), 1)
        call('trashfeeds')
        assert_equals(Feed.trashed.count(), 0)

    def test_valid_feeds_never_gets_trashed(self):
        feed = FeedFactory(trashed_at=None)
        assert_equals(Feed.objects.count(), 1)
        call('trashfeeds')
        assert_equals(Feed.objects.count(), 1)

    def test_invalid_feeds_only_get_deleted_when_they_are_marked_as_trash(self):
        assert_equals(Feed.trashed.count(), 1)
        self.feed.trashed_at = None
        self.feed.save()
        call('trashfeeds')

        self.feed.trashed_at = datetime.now()
        self.feed.save()
        assert_equals(Feed.trashed.count(), 1)
Exemplo n.º 2
0
 def setUp(self):
     self.feed = InvalidFeedFactory.build()
     delta = timedelta(hours=2)
     self.time_trashed = datetime.now() - delta
     self.already_trashed_feed = FeedFactory.build(trashed_at=self.time_trashed)
 def setUp(self):
     self.parser = FeedParser(InvalidFeedFactory.build())
Exemplo n.º 4
0
 def setUp(self):
     self.feed = InvalidFeedFactory.build()
 def setUp(self):
     two_hours = timedelta(hours=2)
     time_invalidated = datetime.now() - two_hours
     self.feed = InvalidFeedFactory(trashed_at=time_invalidated)