From dab453480e003a38bb455a7dee84de38a603f319 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: May 04 2020 12:25:57 +0000 Subject: Adjust the unit-tests for arrow 0.15.6+ Signed-off-by: Pierre-Yves Chibon --- diff --git a/tests/test_pagure_flask_api_user.py b/tests/test_pagure_flask_api_user.py index 3331f8d..9a37fdc 100644 --- a/tests/test_pagure_flask_api_user.py +++ b/tests/test_pagure_flask_api_user.py @@ -331,7 +331,18 @@ class PagureFlaskApiUSertests(tests.Modeltests): # Invalid date, arrow >= 0.15 throws an exception, # previous versions parsed it output = self.app.get("/api/0/user/pingou/activity/2016asd") - if self.get_arrow_version() >= (0, 15): + arrow_version = self.get_arrow_version() + if arrow_version >= (0, 15, 6): + self.assertEqual(output.status_code, 400) + exp = { + "error": "Could not match input '2016asd' to any of the following formats: " + "YYYY-MM-DD, YYYY-M-DD, YYYY-M-D, YYYY/MM/DD, YYYY/M/DD, YYYY/M/D, " + "YYYY.MM.DD, YYYY.M.DD, YYYY.M.D, YYYYMMDD, YYYY-DDDD, YYYYDDDD, " + "YYYY-MM, YYYY/MM, YYYY.MM, YYYY, W", + "error_code": "ENOCODE", + } + self.assertEqual(json.loads(output.get_data(as_text=True)), exp) + elif arrow_version >= (0, 15): self.assertEqual(output.status_code, 400) exp = { "error": "Could not match input '2016asd' to any of the following formats: "