def test_relative_timestamp_none(self): test_time = datetime.utcnow() - timedelta(days=999) result = template_filters._relative_timestamp(test_time) self.assertEquals(None, result)
def test_relative_timestamp_days(self): test_time = datetime.utcnow() - timedelta(days=4) result = template_filters._relative_timestamp(test_time) self.assertEquals("4 days", result)
def test_relative_timestamp_one_minute(self): test_time = datetime.utcnow() - timedelta(minutes=1) result = template_filters._relative_timestamp(test_time) self.assertEquals("a minute", result)
def test_relative_timestamp_hours(self): test_time = datetime.utcnow() - timedelta(hours=10) result = template_filters._relative_timestamp(test_time) self.assertEquals("10 hours", result)
def test_relative_timestamp_seconds(self): test_time = datetime.utcnow() - timedelta(seconds=5) result = template_filters._relative_timestamp(test_time) self.assertIn("seconds", result)