diff options
| author | Hunternif <hunternif@gmail.com> | 2025-02-16 02:03:11 +0000 |
|---|---|---|
| committer | Hunternif <hunternif@gmail.com> | 2025-02-16 02:03:11 +0000 |
| commit | de70036baba5b5dff869c79c3ec79e8726990b49 (patch) | |
| tree | 2d1293121d6ed55b64f7cb5510565786fb415612 | |
| parent | a859d448b2573bab7990521aa4dcb823ba576801 (diff) | |
| parent | 7e09f39cb9c6ad5ffb20411906c13aca74343617 (diff) | |
Merge branch 'priv-view-unsafe-posts' into hunternif
3 files changed, 20 insertions, 10 deletions
diff --git a/server/szurubooru/tests/api/test_post_retrieving.py b/server/szurubooru/tests/api/test_post_retrieving.py index b2d5c8e..0e9e918 100644 --- a/server/szurubooru/tests/api/test_post_retrieving.py +++ b/server/szurubooru/tests/api/test_post_retrieving.py @@ -17,6 +17,7 @@ def inject_config(config_injector): "posts:list": model.User.RANK_REGULAR, "posts:view": model.User.RANK_REGULAR, "posts:view:unsafe": model.User.RANK_REGULAR, + "posts:list:unsafe": model.User.RANK_REGULAR, }, } ) diff --git a/server/szurubooru/tests/search/configs/test_post_search_config.py b/server/szurubooru/tests/search/configs/test_post_search_config.py index cdd60ec..f04dabc 100644 --- a/server/szurubooru/tests/search/configs/test_post_search_config.py +++ b/server/szurubooru/tests/search/configs/test_post_search_config.py @@ -60,7 +60,15 @@ def executor(): @pytest.fixture -def auth_executor(executor, user_factory): +def auth_executor(executor, user_factory, config_injector): + config_injector( + { + "privileges": { + "posts:list:unsafe": model.User.RANK_REGULAR, + } + } + ) + def wrapper(): auth_user = user_factory() db.session.add(auth_user) @@ -1086,15 +1094,7 @@ def test_filter_unsafe_without_privilege( auth_executor, verify_unpaged, post_factory, - config_injector, ): - config_injector( - { - "privileges": { - "posts:list:unsafe": model.User.RANK_REGULAR, - } - } - ) post1 = post_factory(id=1) post2 = post_factory(id=2, safety=model.Post.SAFETY_SKETCHY) post3 = post_factory(id=3, safety=model.Post.SAFETY_UNSAFE) diff --git a/server/szurubooru/tests/search/test_executor.py b/server/szurubooru/tests/search/test_executor.py index 4530bee..5c52f72 100644 --- a/server/szurubooru/tests/search/test_executor.py +++ b/server/szurubooru/tests/search/test_executor.py @@ -2,10 +2,19 @@ import unittest.mock import pytest -from szurubooru import search +from szurubooru import search, model from szurubooru.func import cache +@pytest.fixture(autouse=True) +def inject_config(config_injector): + config_injector( + { + "privileges": {"posts:list:unsafe": model.User.RANK_REGULAR}, + } + ) + + def test_retrieving_from_cache(): config = unittest.mock.MagicMock() with unittest.mock.patch("szurubooru.func.cache.has"), unittest.mock.patch( |