From 625c146d386ea19a9801cc1f4e69d38a55469da1 Mon Sep 17 00:00:00 2001 From: Azhar Ismagulova <31756707+azharcodeit@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:42:57 +0100 Subject: [PATCH] test(backend): add test for GET /organisation/ endpoint (#1658) * test: get list of all organisations * refactor: remove redundant access_token fixture --- src/backend/tests/test_organisation_routes.py | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/backend/tests/test_organisation_routes.py diff --git a/src/backend/tests/test_organisation_routes.py b/src/backend/tests/test_organisation_routes.py new file mode 100644 index 0000000000..27e3942085 --- /dev/null +++ b/src/backend/tests/test_organisation_routes.py @@ -0,0 +1,37 @@ +# Copyright (c) 2022, 2023 Humanitarian OpenStreetMap Team +# +# This file is part of FMTM. +# +# FMTM is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# FMTM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with FMTM. If not, see . +# +"""Tests for organisation routes.""" + +import pytest + + +async def test_get_organisation(client, organisation): + """Test get list of organisations.""" + response = client.get("/organisation/") + assert response.status_code == 200 + + data = response.json()[-1] + + assert organisation.id == data["id"] + assert organisation.name == data["name"] + assert organisation.description == data["description"] + + +if __name__ == "__main__": + """Main func if file invoked directly.""" + pytest.main()