aboutsummaryrefslogtreecommitdiff
path: root/server/szurubooru/tests/api/test_post_retrieving.py
diff options
context:
space:
mode:
authorrr-2016-06-06 22:25:50 +0200
committerrr-2016-06-08 22:38:35 +0200
commitded89fee5f5d2d9ad5392149621e968771dc805c (patch)
tree498c20c2a559a320ea910576ef7934dcb4532916 /server/szurubooru/tests/api/test_post_retrieving.py
parent053d1889e08dd07a68e033f5c95986daaab6dd33 (diff)
server/posts: fix handling bad post ID
Diffstat (limited to 'server/szurubooru/tests/api/test_post_retrieving.py')
-rw-r--r--server/szurubooru/tests/api/test_post_retrieving.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/server/szurubooru/tests/api/test_post_retrieving.py b/server/szurubooru/tests/api/test_post_retrieving.py
index 41c6ead..5b1c38c 100644
--- a/server/szurubooru/tests/api/test_post_retrieving.py
+++ b/server/szurubooru/tests/api/test_post_retrieving.py
@@ -83,16 +83,23 @@ def test_retrieving_single(test_ctx):
assert 'snapshots' in result
assert 'comments' in result
+def test_trying_to_retrieve_invalid_id(test_ctx):
+ with pytest.raises(posts.InvalidPostIdError):
+ test_ctx.detail_api.get(
+ test_ctx.context_factory(
+ user=test_ctx.user_factory(rank=db.User.RANK_REGULAR)),
+ '-')
+
def test_trying_to_retrieve_single_non_existing(test_ctx):
with pytest.raises(posts.PostNotFoundError):
test_ctx.detail_api.get(
test_ctx.context_factory(
user=test_ctx.user_factory(rank=db.User.RANK_REGULAR)),
- '-')
+ '999')
def test_trying_to_retrieve_single_without_privileges(test_ctx):
with pytest.raises(errors.AuthError):
test_ctx.detail_api.get(
test_ctx.context_factory(
user=test_ctx.user_factory(rank=db.User.RANK_ANONYMOUS)),
- '-')
+ '999')

© 2015 - 2026 Jakob L. Kreuze