def test_age(self):
now = datetime.now(tz=tz.tzutc())
three_months = now - timedelta(90)
two_months = now - timedelta(60)
one_month = now - timedelta(30)
def i(d):
return instance(LaunchTime=d)
fdata = {
'type': 'value',
'key': 'LaunchTime',
'op': 'less-than',
'value_type': 'age',
'value': 32}
self.assertFilter(fdata, i(three_months), False)
self.assertFilter(fdata, i(two_months), False)
self.assertFilter(fdata, i(one_month), True)
self.assertFilter(fdata, i(now), True)
self.assertFilter(fdata, i(now.isoformat()), True)
评论列表
文章目录