File tree Expand file tree Collapse file tree 4 files changed +5
-5
lines changed Expand file tree Collapse file tree 4 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -58,8 +58,8 @@ def hello_http(request):
58
58
<http://flask.pocoo.org/docs/0.12/api/#flask.Flask.make_response>.
59
59
"""
60
60
request_json = request .get_json ()
61
- if request_json and 'message ' in request_json :
62
- name = request_json ['message ' ]
61
+ if request_json and 'name ' in request_json :
62
+ name = request_json ['name ' ]
63
63
else :
64
64
name = 'World'
65
65
return 'Hello, {}!' .format (name )
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ def test_hello_http_no_args(app):
37
37
38
38
39
39
def test_hello_http_args (app ):
40
- with app .test_request_context (json = {'message ' : 'test' }):
40
+ with app .test_request_context (json = {'name ' : 'test' }):
41
41
res = main .hello_http (flask .request )
42
42
assert 'Hello, test!' in res
43
43
Original file line number Diff line number Diff line change 20
20
21
21
def test_print_name ():
22
22
name = 'test'
23
- req = Mock (get_json = Mock (return_value = {'message ' : name }))
23
+ req = Mock (get_json = Mock (return_value = {'name ' : name }))
24
24
25
25
# Call tested function
26
26
assert main .hello_http (req ) == 'Hello, {}!' .format (name )
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ def test_args():
34
34
name = str (uuid .uuid4 ())
35
35
res = requests .post (
36
36
'{}/hello_http' .format (BASE_URL ),
37
- json = {'message ' : name }
37
+ json = {'name ' : name }
38
38
)
39
39
assert res .text == 'Hello, {}!' .format (name )
40
40
# [END functions_http_system_test]
You can’t perform that action at this time.
0 commit comments