| Conditions | 1 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | import datetime |
||
| 11 | def test_run_success(self): |
||
| 12 | action = ParseDateStringAction() |
||
| 13 | |||
| 14 | result = action.run(date_string='now') |
||
| 15 | expected = arrow.utcnow().timestamp |
||
| 16 | self.assertTrue(result in [expected, (expected + 1), (expected - 1)]) |
||
| 17 | |||
| 18 | result = action.run(date_string='1 hour ago') |
||
| 19 | expected = arrow.utcnow().replace(hours=-1).timestamp |
||
| 20 | self.assertEqual(result, expected) |
||
| 21 | |||
| 22 | result = action.run(date_string='3 days ago') |
||
| 23 | expected = arrow.utcnow().replace(days=-3).timestamp |
||
| 24 | self.assertEqual(result, expected) |
||
| 25 | |||
| 26 | result = action.run(date_string='2013-05-12') |
||
| 27 | expected = datetime.datetime(2013, 5, 12) |
||
| 28 | expected = arrow.get(expected).timestamp |
||
| 29 | self.assertEqual(result, expected) |
||
| 30 | |||
| 34 |