File tree 1 file changed +14
-0
lines changed 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,12 @@ def test_hello_http_args(app):
42
42
assert 'Hello, test!' in res
43
43
44
44
45
+ def test_hello_http_empty_json (app ):
46
+ with app .test_request_context (json = '' ):
47
+ res = main .hello_http (flask .request )
48
+ assert 'Hello, World!' in res
49
+
50
+
45
51
def test_hello_http_xss (app ):
46
52
with app .test_request_context (json = {'name' : '<script>alert(1)</script>' }):
47
53
res = main .hello_http (flask .request )
@@ -54,6 +60,14 @@ def test_hello_content_json(app):
54
60
assert 'Hello, test!' in res
55
61
56
62
63
+ def test_hello_content_empty_json (app ):
64
+ with app .test_request_context (json = '' ):
65
+ with pytest .raises (
66
+ ValueError ,
67
+ message = "JSON is invalid, or missing a 'name' property" ):
68
+ main .hello_content (flask .request )
69
+
70
+
57
71
def test_hello_content_urlencoded (app ):
58
72
with app .test_request_context (
59
73
data = {'name' : 'test' },
You can’t perform that action at this time.
0 commit comments