diff --git a/tests/integration_tests/dashboards/api_tests.py b/tests/integration_tests/dashboards/api_tests.py index 360a204c3eed1..b40fa991b656b 100644 --- a/tests/integration_tests/dashboards/api_tests.py +++ b/tests/integration_tests/dashboards/api_tests.py @@ -413,29 +413,29 @@ def test_get_dashboards_changed_on(self): from datetime import datetime import humanize - admin = self.get_user("admin") - start_changed_on = datetime.now() - dashboard = self.insert_dashboard("title", "slug1", [admin.id]) - - self.login(username="admin") - - arguments = { - "order_column": "changed_on_delta_humanized", - "order_direction": "desc", - } - uri = f"api/v1/dashboard/?q={prison.dumps(arguments)}" - - rv = self.get_assert_metric(uri, "get_list") - self.assertEqual(rv.status_code, 200) - data = json.loads(rv.data.decode("utf-8")) - self.assertEqual( - data["result"][0]["changed_on_delta_humanized"], - humanize.naturaltime(datetime.now() - start_changed_on), - ) + with freeze_time("2020-01-01T00:00:00Z"): + admin = self.get_user("admin") + dashboard = self.insert_dashboard("title", "slug1", [admin.id]) + + self.login(username="admin") + + arguments = { + "order_column": "changed_on_delta_humanized", + "order_direction": "desc", + } + uri = f"api/v1/dashboard/?q={prison.dumps(arguments)}" + + rv = self.get_assert_metric(uri, "get_list") + self.assertEqual(rv.status_code, 200) + data = json.loads(rv.data.decode("utf-8")) + self.assertEqual( + data["result"][0]["changed_on_delta_humanized"], + humanize.naturaltime(datetime.now()), + ) - # rollback changes - db.session.delete(dashboard) - db.session.commit() + # rollback changes + db.session.delete(dashboard) + db.session.commit() def test_get_dashboards_filter(self): """