Validate config JSON body shape
This commit is contained in:
@@ -1103,6 +1103,13 @@ class HandlerRouteTests(unittest.TestCase):
|
||||
APP.Handler.body_json(handler)
|
||||
self.assertIn("utf-8", str(ctx.exception).lower())
|
||||
|
||||
def test_config_post_rejects_non_object_json_body(self):
|
||||
body = b"[]"
|
||||
handler = DummyHandler("/api/config", body=body, content_length=len(body))
|
||||
APP.Handler.do_POST(handler)
|
||||
self.assertEqual(handler.error_status, HTTPStatus.BAD_REQUEST)
|
||||
self.assertIn("json object", handler.error_message.lower())
|
||||
|
||||
def test_remove_post_missing_show_id_returns_bad_request(self):
|
||||
handler = DummyHandler("/api/watchlist/remove", body=b"{}", content_length=2)
|
||||
APP.Handler.do_POST(handler)
|
||||
|
||||
Reference in New Issue
Block a user