From 3954f2f17005ddb9898e090ff8f2553b2eaa67e7 Mon Sep 17 00:00:00 2001 From: imperosol Date: Wed, 22 Apr 2026 10:59:56 +0200 Subject: [PATCH] apply review comments --- sas/models.py | 2 +- sas/tests/test_views.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sas/models.py b/sas/models.py index c5d53410..64f6c15b 100644 --- a/sas/models.py +++ b/sas/models.py @@ -205,7 +205,7 @@ class AlbumQuerySet(models.QuerySet): class SASAlbumManager(models.Manager): def get_queryset(self): - return super().get_queryset().filter(Q(is_in_sas=True, is_folder=True)) + return super().get_queryset().filter(is_in_sas=True, is_folder=True) class Album(SasFile): diff --git a/sas/tests/test_views.py b/sas/tests/test_views.py index bc2e6cab..ffa48beb 100644 --- a/sas/tests/test_views.py +++ b/sas/tests/test_views.py @@ -80,6 +80,7 @@ def test_main_page_displayed_albums(client: Client): # album_b is not a direct child of the SAS, so it shouldn't be displayed # in the categories, but it should appear in the latest albums. # album_d isn't moderated, so it shouldn't appear at all for a simple user. + # Also, the SAS itself shouldn't be listed in the albums. assert res.context_data["latest"] == [album_c, album_b, album_a] assert res.context_data["categories"] == [album_a, album_c] @@ -109,6 +110,15 @@ def test_album_access_non_subscriber(client: Client): assert res.status_code == 200 +@pytest.mark.django_db +def test_accessing_sas_from_album_view_is_404(client: Client): + """Test that trying to see the SAS with a regular album view isn't allowed.""" + res = client.get( + reverse("sas:album", kwargs={"album_id": settings.SITH_SAS_ROOT_DIR_ID}) + ) + assert res.status_code == 404 + + @pytest.mark.django_db class TestAlbumUpload: @staticmethod