From f966b7b58dc613361768aaf4817b92c7912a7e8c Mon Sep 17 00:00:00 2001 From: Jacobe2169 Date: Thu, 7 Mar 2024 16:41:36 +0100 Subject: [PATCH] add export habitat benchmark test --- .../tests/benchmarks/test_benchmark_occhab.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/backend/geonature/tests/benchmarks/test_benchmark_occhab.py b/backend/geonature/tests/benchmarks/test_benchmark_occhab.py index 173d875579..5b8e920233 100644 --- a/backend/geonature/tests/benchmarks/test_benchmark_occhab.py +++ b/backend/geonature/tests/benchmarks/test_benchmark_occhab.py @@ -16,20 +16,32 @@ @pytest.mark.usefixtures("client_class", "temporary_transaction") class TestBenchmarkOcchab: - test_occhab_get_station = BenchmarkTest( + test_get_station = BenchmarkTest( CLIENT_GET, [CLater("""url_for("occhab.get_station", id_station=8)""")], dict(user_profile="user", fixtures=[stations]), )() - test_occhab_list_stations = BenchmarkTest( + test_list_stations = BenchmarkTest( CLIENT_GET, [CLater("""url_for("occhab.list_stations")""")], dict(user_profile="admin_user", fixtures=[]), )() - test_occhab_list_stations_restricted = BenchmarkTest( + test_list_stations_restricted = BenchmarkTest( CLIENT_GET, [CLater("""url_for("occhab.list_stations")""")], dict(user_profile="user_restricted_occhab", fixtures=[]), )() + + +for format_ in "csv geojson shapefile".split(): + setattr( + TestBenchmarkOcchab, + f"test_export_all_habitats_{format_}", + BenchmarkTest( + CLIENT_POST, + [CLater("""url_for("occhab.export_all_habitats",export_format="csv")""")], + dict(user_profile="admin_user", fixtures=[]), + )(), + )