From de9725c968b92793ef5f0494f119f557720a91e2 Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Tue, 1 Oct 2024 16:52:32 +0000 Subject: [PATCH] fix: enforce an owner on server-created projects --- sample_data/ingest_use_case.py | 1 + uvdat/core/tests/conftest.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sample_data/ingest_use_case.py b/sample_data/ingest_use_case.py index 4f806719..b8f8501d 100644 --- a/sample_data/ingest_use_case.py +++ b/sample_data/ingest_use_case.py @@ -75,6 +75,7 @@ def ingest_projects(use_case): print('\t', f'Project {project_for_setting.name} created.') project_for_setting.datasets.set(Dataset.objects.filter(name__in=project['datasets'])) + project_for_setting.set_permissions(owner=User.objects.filter(is_superuser=True).first()) def ingest_charts(use_case): diff --git a/uvdat/core/tests/conftest.py b/uvdat/core/tests/conftest.py index 807a8c88..8d92203d 100644 --- a/uvdat/core/tests/conftest.py +++ b/uvdat/core/tests/conftest.py @@ -54,9 +54,12 @@ @pytest.fixture def test_project() -> Project: - return Project.objects.create( + project = Project.objects.create( name='Test Project', default_map_zoom=10, default_map_center=Point(42, -71) ) + original_owner = User.objects.create(username='testowner') + project.set_permissions(owner=original_owner) + return project @pytest.fixture