From ffd0243d02a607398e725ecd65720b0be959b5a3 Mon Sep 17 00:00:00 2001 From: Andria Capai Date: Wed, 31 Jan 2024 14:28:42 +0100 Subject: [PATCH] test(back): add test on sort destination.label test changes apply to route get_import_list Reviewed-by: andriac --- backend/geonature/tests/imports/test_imports_route.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/geonature/tests/imports/test_imports_route.py b/backend/geonature/tests/imports/test_imports_route.py index 960ccaa774..4248f81207 100644 --- a/backend/geonature/tests/imports/test_imports_route.py +++ b/backend/geonature/tests/imports/test_imports_route.py @@ -60,3 +60,13 @@ def test_list_imports(self, imports_all, all_modules_destination, users): ] assert all(imprt["id_destination"] in ids_destination for imprt in json_data["imports"]) + + def test_order_import_foreign(self, users, imports_all): + set_logged_user(self.client, users["user"]) + response = self.client.get(url_for("import.get_import_list") + "?sort=destination.label") + assert response.status_code == 200, response.data + imports = response.get_json()["imports"] + for a, b in zip(imports[:1], imports[1:]): + assert (a["destination"] is None) or ( + a["destination"]["code"] <= b["destination"]["code"] + ) \ No newline at end of file