Skip to content

Commit f207e55

Browse files
author
Vladimir Kotal
committed
add missing param (verb)
1 parent 9040eb1 commit f207e55

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

opengrok-tools/src/main/python/opengrok_tools/utils/restful.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@
2222
#
2323

2424
import logging
25-
from .webutil import put, post, delete
2625
import json
2726

27+
from .webutil import put, post, delete
28+
from .patterns import COMMAND_PROPERTY
29+
2830

29-
def do_api_call(command, uri, headers, json_data):
31+
def do_api_call(command, uri, verb, headers, json_data):
3032
logger = logging.getLogger(__name__)
3133

3234
if verb == 'PUT':
@@ -50,7 +52,7 @@ def call_rest_api(command, pattern, name):
5052
:param name: command name
5153
:return return value from given requests method
5254
"""
53-
command = command.get("command")
55+
command = command.get(COMMAND_PROPERTY)
5456
uri = command[0].replace(pattern, name)
5557
verb = command[1]
5658
data = command[2]
@@ -64,4 +66,4 @@ def call_rest_api(command, pattern, name):
6466
json_data = json.dumps(data).replace(pattern, name)
6567
logger.debug("JSON data: {}".format(json_data))
6668

67-
return do_api_call(command, uri, headers, json_data)
69+
return do_api_call(command, uri, verb, headers, json_data)

opengrok-tools/src/test/python/test_restful.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class MockResponse:
3434
def __init__(self):
3535
self.status_code = okay_status
3636

37-
def mock_response(command, uri, headers, json_data):
37+
def mock_response(command, uri, verb, headers, json_data):
3838
# Spying on mocked function is maybe too much so verify
3939
# the arguments here.
4040
assert uri == "http://localhost:8080/source/api/v1/BAR"

0 commit comments

Comments
 (0)