def test_expired_view_1(self): f1 = Feed(u"http://example.com/1") i1 = Item(fp_values_for_url(u"http://example.com/1/item1"), feed_id=f1.id) i2 = Item(fp_values_for_url(u"http://example.com/1/item2"), feed_id=f1.id) f1.set_expiration(u"never", 0) i1.watchedTime = i2.watchedTime = datetime.now() for obj in (f1, i1, i2): obj.signal_change() self.assertEquals(list(f1.expiring_items()), [])
def test_expired_view_3(self): f3 = Feed(u"http://example.com/3") i5 = Item(fp_values_for_url(u"http://example.com/3/item1"), feed_id=f3.id) i6 = Item(fp_values_for_url(u"http://example.com/3/item2"), feed_id=f3.id) f3.set_expiration(u"feed", 24) i5.watchedTime = datetime.now() - timedelta(days=3) i6.watchedTime = datetime.now() - timedelta(hours=12) for obj in (f3, i5, i6): obj.signal_change() self.assertEquals(list(f3.expiring_items()), [i5])
def test_expired_view_1(self): f1 = Feed(u'http://example.com/1') i1 = Item(fp_values_for_url(u'http://example.com/1/item1'), feed_id=f1.id) i2 = Item(fp_values_for_url(u'http://example.com/1/item2'), feed_id=f1.id) f1.set_expiration(u'never', 0) i1.watched_time = i2.watched_time = datetime.now() for obj in (f1, i1, i2): obj.signal_change() self.assertEquals(list(f1.expiring_items()), [])
def test_expired_view_3(self): f3 = Feed(u'http://example.com/3') i5 = Item(fp_values_for_url(u'http://example.com/3/item1'), feed_id=f3.id) i6 = Item(fp_values_for_url(u'http://example.com/3/item2'), feed_id=f3.id) f3.set_expiration(u'feed', 24) i5.watched_time = datetime.now() - timedelta(days=3) i6.watched_time = datetime.now() - timedelta(hours=12) for obj in (f3, i5, i6): obj.signal_change() self.assertEquals(list(f3.expiring_items()), [i5])
def test_expired_view_2(self): f2 = Feed(u"http://example.com/2") i3 = Item(fp_values_for_url(u"http://example.com/2/item1"), feed_id=f2.id) i4 = Item(fp_values_for_url(u"http://example.com/2/item2"), feed_id=f2.id) f2.set_expiration(u"system", 0) # system default is 6 days as set in setUp, so i3 should expire, # but i4 should not. i3.watchedTime = datetime.now() - timedelta(days=12) i4.watchedTime = datetime.now() - timedelta(days=3) for obj in (f2, i3, i4): obj.signal_change() self.assertEquals(list(f2.expiring_items()), [i3])
def test_expired_view_2(self): f2 = Feed(u'http://example.com/2') i3 = Item(fp_values_for_url(u'http://example.com/2/item1'), feed_id=f2.id) i4 = Item(fp_values_for_url(u'http://example.com/2/item2'), feed_id=f2.id) f2.set_expiration(u'system', 0) # system default is 6 days as set in setUp, so i3 should expire, # but i4 should not. i3.watched_time = datetime.now() - timedelta(days=12) i4.watched_time = datetime.now() - timedelta(days=3) for obj in (f2, i3, i4): obj.signal_change() self.assertEquals(list(f2.expiring_items()), [i3])