diff options
| author | rr- | 2016-06-06 22:25:50 +0200 |
|---|---|---|
| committer | rr- | 2016-06-08 22:38:35 +0200 |
| commit | ded89fee5f5d2d9ad5392149621e968771dc805c (patch) | |
| tree | 498c20c2a559a320ea910576ef7934dcb4532916 /server/szurubooru/tests/api | |
| parent | 053d1889e08dd07a68e033f5c95986daaab6dd33 (diff) | |
server/posts: fix handling bad post ID
Diffstat (limited to 'server/szurubooru/tests/api')
| -rw-r--r-- | server/szurubooru/tests/api/test_post_deleting.py | 2 | ||||
| -rw-r--r-- | server/szurubooru/tests/api/test_post_retrieving.py | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/server/szurubooru/tests/api/test_post_deleting.py b/server/szurubooru/tests/api/test_post_deleting.py index 06cad18..0fa1c92 100644 --- a/server/szurubooru/tests/api/test_post_deleting.py +++ b/server/szurubooru/tests/api/test_post_deleting.py @@ -35,7 +35,7 @@ def test_trying_to_delete_non_existing(test_ctx): with pytest.raises(posts.PostNotFoundError): test_ctx.api.delete( test_ctx.context_factory( - user=test_ctx.user_factory(rank=db.User.RANK_REGULAR)), 'bad') + user=test_ctx.user_factory(rank=db.User.RANK_REGULAR)), '999') def test_trying_to_delete_without_privileges(test_ctx): db.session.add(test_ctx.post_factory(id=1)) 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') |