def test_get_end_time_non_digit(self): with self.assertRaises(chalice.BadRequestError) as err: app._get_end_time({"end_time": "not a digit"}, 1550088010) err_status_code = 400 err_msg = "BadRequestError: Invalid end time type." self.assertEqual(err.exception.STATUS_CODE, err_status_code) self.assertEqual(str(err.exception), err_msg)
def test_get_end_time_less_than_zero(self): with self.assertRaises(chalice.BadRequestError) as err: app._get_end_time({"end_time": "-4"}, 1550088010) err_status_code = 400 err_msg = "BadRequestError: The end time value cannot be negative." self.assertEqual(err.exception.STATUS_CODE, err_status_code) self.assertEqual(str(err.exception), err_msg)
def test_get_end_time_ok(self): self.assertEqual( 1550088000, # Default app._get_end_time({ "end_time": "1550088000" }, 1550088010), )
def test_get_end_time_no_query_params(self): self.assertEqual( 1550088010, # Default app._get_end_time(None, 1550088010), )