aboutsummaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorrr-2016-05-11 18:42:02 +0200
committerrr-2016-05-11 18:42:56 +0200
commita5b2d835d649914943ea5a655206192e56746655 (patch)
treecd06d0b0c35d2d671ff2aa02b530592c33a1a592 /server
parent59ae0a4c9a9b363306f2172e08dcec750dc40607 (diff)
server/tags: fix wrong case in merging requests
Diffstat (limited to 'server')
-rw-r--r--server/szurubooru/api/tag_api.py2
-rw-r--r--server/szurubooru/tests/api/test_tag_merging.py24
2 files changed, 13 insertions, 13 deletions
diff --git a/server/szurubooru/api/tag_api.py b/server/szurubooru/api/tag_api.py
index b5d7be7..a410d05 100644
--- a/server/szurubooru/api/tag_api.py
+++ b/server/szurubooru/api/tag_api.py
@@ -77,7 +77,7 @@ class TagDetailApi(BaseApi):
class TagMergeApi(BaseApi):
def post(self, ctx):
source_tag_name = ctx.get_param_as_string('remove', required=True) or ''
- target_tag_name = ctx.get_param_as_string('merge-to', required=True) or ''
+ target_tag_name = ctx.get_param_as_string('mergeTo', required=True) or ''
source_tag = tags.get_tag_by_name(source_tag_name)
target_tag = tags.get_tag_by_name(target_tag_name)
if source_tag.tag_id == target_tag.tag_id:
diff --git a/server/szurubooru/tests/api/test_tag_merging.py b/server/szurubooru/tests/api/test_tag_merging.py
index b16252f..2171cae 100644
--- a/server/szurubooru/tests/api/test_tag_merging.py
+++ b/server/szurubooru/tests/api/test_tag_merging.py
@@ -30,7 +30,7 @@ def test_merging_without_usages(test_ctx, fake_datetime):
test_ctx.context_factory(
input={
'remove': 'source',
- 'merge-to': 'target',
+ 'mergeTo': 'target',
},
user=test_ctx.user_factory(rank=db.User.RANK_REGULAR)))
assert result['tag'] == {
@@ -66,7 +66,7 @@ def test_merging_with_usages(test_ctx, fake_datetime, post_factory):
test_ctx.context_factory(
input={
'remove': 'source',
- 'merge-to': 'target',
+ 'mergeTo': 'target',
},
user=test_ctx.user_factory(rank=db.User.RANK_REGULAR)))
assert tags.try_get_tag_by_name('source') is None
@@ -76,9 +76,9 @@ def test_merging_with_usages(test_ctx, fake_datetime, post_factory):
({'remove': None}, tags.TagNotFoundError),
({'remove': ''}, tags.TagNotFoundError),
({'remove': []}, tags.TagNotFoundError),
- ({'merge-to': None}, tags.TagNotFoundError),
- ({'merge-to': ''}, tags.TagNotFoundError),
- ({'merge-to': []}, tags.TagNotFoundError),
+ ({'mergeTo': None}, tags.TagNotFoundError),
+ ({'mergeTo': ''}, tags.TagNotFoundError),
+ ({'mergeTo': []}, tags.TagNotFoundError),
])
def test_trying_to_pass_invalid_input(test_ctx, input, expected_exception):
source_tag = test_ctx.tag_factory(names=['source'], category_name='meta')
@@ -87,7 +87,7 @@ def test_trying_to_pass_invalid_input(test_ctx, input, expected_exception):
db.session.commit()
real_input = {
'remove': 'source',
- 'merge-to': 'target',
+ 'mergeTo': 'target',
}
for key, value in input.items():
real_input[key] = value
@@ -98,7 +98,7 @@ def test_trying_to_pass_invalid_input(test_ctx, input, expected_exception):
user=test_ctx.user_factory(rank=db.User.RANK_REGULAR)))
@pytest.mark.parametrize(
- 'field', ['remove', 'merge-to'])
+ 'field', ['remove', 'mergeTo'])
def test_trying_to_omit_mandatory_field(test_ctx, field):
db.session.add_all([
test_ctx.tag_factory(names=['source'], category_name='meta'),
@@ -107,7 +107,7 @@ def test_trying_to_omit_mandatory_field(test_ctx, field):
db.session.commit()
input = {
'remove': 'source',
- 'merge-to': 'target',
+ 'mergeTo': 'target',
}
del input[field]
with pytest.raises(errors.ValidationError):
@@ -122,12 +122,12 @@ def test_trying_to_merge_non_existing(test_ctx):
with pytest.raises(tags.TagNotFoundError):
test_ctx.api.post(
test_ctx.context_factory(
- input={'remove': 'good', 'merge-to': 'bad'},
+ input={'remove': 'good', 'mergeTo': 'bad'},
user=test_ctx.user_factory(rank=db.User.RANK_REGULAR)))
with pytest.raises(tags.TagNotFoundError):
test_ctx.api.post(
test_ctx.context_factory(
- input={'remove': 'bad', 'merge-to': 'good'},
+ input={'remove': 'bad', 'mergeTo': 'good'},
user=test_ctx.user_factory(rank=db.User.RANK_REGULAR)))
def test_trying_to_merge_to_itself(test_ctx):
@@ -136,7 +136,7 @@ def test_trying_to_merge_to_itself(test_ctx):
with pytest.raises(tags.InvalidTagRelationError):
test_ctx.api.post(
test_ctx.context_factory(
- input={'remove': 'good', 'merge-to': 'good'},
+ input={'remove': 'good', 'mergeTo': 'good'},
user=test_ctx.user_factory(rank=db.User.RANK_REGULAR)))
@pytest.mark.parametrize('input', [
@@ -156,6 +156,6 @@ def test_trying_to_merge_without_privileges(test_ctx, input):
test_ctx.context_factory(
input={
'remove': 'source',
- 'merge-to': 'target',
+ 'mergeTo': 'target',
},
user=test_ctx.user_factory(rank=db.User.RANK_ANONYMOUS)))

© 2015 - 2026 Jakob L. Kreuze