Fix flaky template test (#6768)
This commit is contained in:
parent
5dfdb9e481
commit
efbd66bca1
1 changed files with 6 additions and 4 deletions
|
@ -151,13 +151,14 @@ class TestHelpersTemplate(unittest.TestCase):
|
|||
|
||||
def test_timestamp_custom(self):
|
||||
"""Test the timestamps to custom filter."""
|
||||
now = dt_util.utcnow()
|
||||
tests = [
|
||||
(None, None, None, 'None'),
|
||||
(1469119144, None, True, '2016-07-21 16:39:04'),
|
||||
(1469119144, '%Y', True, '2016'),
|
||||
(1469119144, 'invalid', True, 'invalid'),
|
||||
(dt_util.as_timestamp(dt_util.utcnow()), None, False,
|
||||
dt_util.now().strftime('%Y-%m-%d %H:%M:%S'))
|
||||
(dt_util.as_timestamp(now), None, False,
|
||||
now.strftime('%Y-%m-%d %H:%M:%S'))
|
||||
]
|
||||
|
||||
for inp, fmt, local, out in tests:
|
||||
|
@ -202,11 +203,12 @@ class TestHelpersTemplate(unittest.TestCase):
|
|||
|
||||
def test_timestamp_utc(self):
|
||||
"""Test the timestamps to local filter."""
|
||||
now = dt_util.utcnow()
|
||||
tests = {
|
||||
None: 'None',
|
||||
1469119144: '2016-07-21 16:39:04',
|
||||
dt_util.as_timestamp(dt_util.utcnow()):
|
||||
dt_util.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
dt_util.as_timestamp(now):
|
||||
now.strftime('%Y-%m-%d %H:%M:%S')
|
||||
}
|
||||
|
||||
for inp, out in tests.items():
|
||||
|
|
Loading…
Add table
Reference in a new issue