Skip to content

Commit

Permalink
Address review feedback - fix comments, add another test case for
Browse files Browse the repository at this point in the history
result_size == max_result_size, clarify query parameter value represents
bytes.
  • Loading branch information
Kami committed Mar 30, 2021
1 parent dc0a1fb commit 0c80a00
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions st2api/tests/unit/controllers/v1/test_executions.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def test_get_one_max_result_size_query_parameter(self):
self.assertEqual(get_resp.json["result"], data["result"])
self.assertEqual(self._get_actionexecution_id(get_resp), actionexecution_id)

# 3. ?max_result_size > actual result size - result field should not be returned
# 3. ?max_result_size < actual result size - result field should not be returned
get_resp = self._do_get_one(
actionexecution_id + "?max_result_size=%s" % (actual_result_size - 1)
)
Expand All @@ -396,7 +396,7 @@ def test_get_one_max_result_size_query_parameter(self):
self.assertTrue("result" not in get_resp.json)
self.assertEqual(self._get_actionexecution_id(get_resp), actionexecution_id)

# 4. ?max_result_size > actual result size and ?include_attributes=result - result field
# 4. ?max_result_size < actual result size and ?include_attributes=result - result field
# should not be returned
get_resp = self._do_get_one(
actionexecution_id
Expand Down Expand Up @@ -440,6 +440,15 @@ def test_get_one_max_result_size_query_parameter(self):
"max_result_size query parameter must be smaller than 14 MB",
)

# 8. ?max_result_size == actual result size - result should be returned
get_resp = self._do_get_one(
actionexecution_id + "?max_result_size=%s" % (actual_result_size)
)
self.assertEqual(get_resp.status_int, 200)
self.assertEqual(get_resp.json["result_size"], actual_result_size)
self.assertEqual(get_resp.json["result"], data["result"])
self.assertEqual(self._get_actionexecution_id(get_resp), actionexecution_id)

def test_get_all_id_query_param_filtering_success(self):
post_resp = self._do_post(LIVE_ACTION_1)
actionexecution_id = self._get_actionexecution_id(post_resp)
Expand Down
2 changes: 1 addition & 1 deletion st2common/st2common/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ paths:
- name: max_result_size
in: query
type: integer
description: True to exclude result field from the response for executions which result field exceeds the provided size.
description: True to exclude result field from the response for executions which result field exceeds the provided size in bytes.
x-parameters:
- name: user
in: context
Expand Down
2 changes: 1 addition & 1 deletion st2common/st2common/openapi.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ paths:
- name: max_result_size
in: query
type: integer
description: True to exclude result field from the response for executions which result field exceeds the provided size.
description: True to exclude result field from the response for executions which result field exceeds the provided size in bytes.
x-parameters:
- name: user
in: context
Expand Down

0 comments on commit 0c80a00

Please sign in to comment.