mirror of
https://github.com/ae-utbm/sith.git
synced 2026-04-22 11:13:14 +00:00
apply review comments
This commit is contained in:
+1
-1
@@ -205,7 +205,7 @@ class AlbumQuerySet(models.QuerySet):
|
|||||||
|
|
||||||
class SASAlbumManager(models.Manager):
|
class SASAlbumManager(models.Manager):
|
||||||
def get_queryset(self):
|
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):
|
class Album(SasFile):
|
||||||
|
|||||||
@@ -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
|
# 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.
|
# 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.
|
# 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["latest"] == [album_c, album_b, album_a]
|
||||||
assert res.context_data["categories"] == [album_a, album_c]
|
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
|
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
|
@pytest.mark.django_db
|
||||||
class TestAlbumUpload:
|
class TestAlbumUpload:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user