Beispiel #1
0
 def test_date_last_refresh_naturaldate(self):
     now = datetime.now(pytz.utc)
     f = models.Feed(name="foo2",
                     feed_url="http://example.com/t2.rss",
                     sort=0,
                     date_last_refresh=now)
     self.assertEqual(f.date_last_refresh_naturaldate, naturaldate(now))
Beispiel #2
0
 def test_date_updated_naturaldate(self):
     now = datetime.now(pytz.utc)
     post = models.Post(feed=self.feed, title="baz", date_updated=now)
     self.assertEqual(post.date_updated_naturaldate, naturaldate(now))
Beispiel #3
0
 def test_date_published_naturaldate(self):
     now = datetime.now(pytz.utc)
     day = datetime(now.year, now.month, now.day, tzinfo=utc)
     post = models.Post(feed=self.feed, title="baz", date_published=now)
     self.assertEqual(post.date_published_naturaldate, naturaldate(day))
Beispiel #4
0
 def date_updated_naturaldate(self):
     return text_type(naturaldate(self.date_updated))
Beispiel #5
0
 def date_published_naturaldate(self):
     date = self.date_published
     as_datetime = datetime(date.year, date.month, date.day, tzinfo=utc)
     return text_type(naturaldate(as_datetime))
Beispiel #6
0
 def date_last_refresh_naturaldate(self):
     return text_type(naturaldate(self.date_last_refresh))