aboutsummaryrefslogtreecommitdiff
path: root/server/szurubooru/tests/api/test_post_merging.py
diff options
context:
space:
mode:
Diffstat (limited to 'server/szurubooru/tests/api/test_post_merging.py')
-rw-r--r--server/szurubooru/tests/api/test_post_merging.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/server/szurubooru/tests/api/test_post_merging.py b/server/szurubooru/tests/api/test_post_merging.py
index e654090..eb8464f 100644
--- a/server/szurubooru/tests/api/test_post_merging.py
+++ b/server/szurubooru/tests/api/test_post_merging.py
@@ -1,16 +1,16 @@
from unittest.mock import patch
import pytest
-from szurubooru import api, db, errors
+from szurubooru import api, db, model, errors
from szurubooru.func import posts, snapshots
@pytest.fixture(autouse=True)
def inject_config(config_injector):
- config_injector({'privileges': {'posts:merge': db.User.RANK_REGULAR}})
+ config_injector({'privileges': {'posts:merge': model.User.RANK_REGULAR}})
def test_merging(user_factory, context_factory, post_factory):
- auth_user = user_factory(rank=db.User.RANK_REGULAR)
+ auth_user = user_factory(rank=model.User.RANK_REGULAR)
source_post = post_factory()
target_post = post_factory()
db.session.add_all([source_post, target_post])
@@ -25,6 +25,7 @@ def test_merging(user_factory, context_factory, post_factory):
'mergeToVersion': 1,
'remove': source_post.post_id,
'mergeTo': target_post.post_id,
+ 'replaceContent': False,
},
user=auth_user))
posts.merge_posts.called_once_with(source_post, target_post)
@@ -45,13 +46,14 @@ def test_trying_to_omit_mandatory_field(
'mergeToVersion': 1,
'remove': source_post.post_id,
'mergeTo': target_post.post_id,
+ 'replaceContent': False,
}
del params[field]
with pytest.raises(errors.ValidationError):
api.post_api.merge_posts(
context_factory(
params=params,
- user=user_factory(rank=db.User.RANK_REGULAR)))
+ user=user_factory(rank=model.User.RANK_REGULAR)))
def test_trying_to_merge_non_existing(
@@ -63,12 +65,12 @@ def test_trying_to_merge_non_existing(
api.post_api.merge_posts(
context_factory(
params={'remove': post.post_id, 'mergeTo': 999},
- user=user_factory(rank=db.User.RANK_REGULAR)))
+ user=user_factory(rank=model.User.RANK_REGULAR)))
with pytest.raises(posts.PostNotFoundError):
api.post_api.merge_posts(
context_factory(
params={'remove': 999, 'mergeTo': post.post_id},
- user=user_factory(rank=db.User.RANK_REGULAR)))
+ user=user_factory(rank=model.User.RANK_REGULAR)))
def test_trying_to_merge_without_privileges(
@@ -85,5 +87,6 @@ def test_trying_to_merge_without_privileges(
'mergeToVersion': 1,
'remove': source_post.post_id,
'mergeTo': target_post.post_id,
+ 'replaceContent': False,
},
- user=user_factory(rank=db.User.RANK_ANONYMOUS)))
+ user=user_factory(rank=model.User.RANK_ANONYMOUS)))

© 2015 - 2026 Jakob L. Kreuze