Skip to content

Commit

Permalink
fix(synthese): revert to user with blurred reading permissions in the…
Browse files Browse the repository at this point in the history
… synthese (#3388)
  • Loading branch information
jacquesfize authored and Christophe-Ramet committed Mar 10, 2025
1 parent a9a1ac8 commit d21bdc2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from .utils import activate_profiling_sql

from .benchmark_generator import BenchmarkTest, CLater
from geonature.tests.fixtures import users


logging.basicConfig()
Expand Down Expand Up @@ -113,4 +114,4 @@ class TestBenchmarkSynthese:
),
)

add_bluring_to_benchmark_test_class(TestBenchmarkSynthese)
add_bluring_to_benchmark_test_class(TestBenchmarkSynthese, "user_with_blurring")
5 changes: 4 additions & 1 deletion backend/geonature/tests/benchmarks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from geonature.tests.test_synthese import blur_sensitive_observations
import traceback
from geonature.tests.fixtures import app
from pypnusershub.db.models import User

logging.basicConfig()
logger = logging.getLogger("logger-name")
Expand Down Expand Up @@ -62,7 +63,7 @@ def after_cursor_execute(conn, cursor, statement, parameters, context, executema
event.listen(db.engine, "after_cursor_execute", after_cursor_execute)


def add_bluring_to_benchmark_test_class(benchmark_cls: type):
def add_bluring_to_benchmark_test_class(benchmark_cls: type, different_user: str = None):
"""
Add the blurring enabling fixture to all benchmark tests declared in the given class.
Expand All @@ -86,6 +87,8 @@ def add_bluring_to_benchmark_test_class(benchmark_cls: type):
if "fixtures" in kwargs
else [blur_sensitive_observations]
)
if different_user:
kwargs["user_profile"] = different_user
# Recreate BenchmarkTest object including the blurring enabling fixture
setattr(
benchmark_cls,
Expand Down

0 comments on commit d21bdc2

Please sign in to comment.