aboutsummaryrefslogtreecommitdiff
path: root/server/szurubooru/tests/api
diff options
context:
space:
mode:
authorrr-2016-07-29 12:44:21 +0200
committerrr-2016-07-30 13:43:15 +0200
commitf40e41ae8beeaef893cb8ed441c66a35c9ce3e2b (patch)
tree80080478cb958a41c542a527d3d475c302ebe0fb /server/szurubooru/tests/api
parentf63851e2cfa2f2ab44437c3ba82dcd31ef4257a3 (diff)
server/tags: allow deleting used tags
Diffstat (limited to 'server/szurubooru/tests/api')
-rw-r--r--server/szurubooru/tests/api/test_tag_deleting.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/server/szurubooru/tests/api/test_tag_deleting.py b/server/szurubooru/tests/api/test_tag_deleting.py
index 634962f..bb7cd49 100644
--- a/server/szurubooru/tests/api/test_tag_deleting.py
+++ b/server/szurubooru/tests/api/test_tag_deleting.py
@@ -31,18 +31,19 @@ def test_deleting(test_ctx):
assert db.session.query(db.Tag).count() == 0
assert os.path.exists(os.path.join(config.config['data_dir'], 'tags.json'))
-def test_trying_to_delete_used(test_ctx, post_factory):
+def test_deleting_used(test_ctx, post_factory):
tag = test_ctx.tag_factory(names=['tag'])
post = post_factory()
post.tags.append(tag)
db.session.add_all([tag, post])
db.session.commit()
- with pytest.raises(tags.TagIsInUseError):
- test_ctx.api.delete(
- test_ctx.context_factory(
- user=test_ctx.user_factory(rank=db.User.RANK_REGULAR)),
- 'tag')
- assert db.session.query(db.Tag).count() == 1
+ test_ctx.api.delete(
+ test_ctx.context_factory(
+ user=test_ctx.user_factory(rank=db.User.RANK_REGULAR)),
+ 'tag')
+ db.session.refresh(post)
+ assert db.session.query(db.Tag).count() == 0
+ assert post.tags == []
def test_trying_to_delete_non_existing(test_ctx):
with pytest.raises(tags.TagNotFoundError):

© 2015 - 2026 Jakob L. Kreuze