Skip to content

Commit

Permalink
CV2-4126 fix missing line (#1871)
Browse files Browse the repository at this point in the history
* CV2-4126 add more explicit flagging to avoid sending stray callback params into callback consumption function

* updates

* resolve broken function tests

* resolve broken test

* resolve one more issue

* CV2-4126 add test to make sure we trigger line
  • Loading branch information
DGaffney authored Apr 30, 2024
1 parent 939f321 commit 3cd7b85
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions test/controllers/webhooks_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,20 @@ def setup
assert_equal expectation, response
end

test "should process Alegre callback webhook" do
test "should process Alegre callback webhook with is_shortcircuited_search_result_callback" do
CheckSentry.expects(:notify).once
id = random_number
payload = { 'action' => 'audio', 'data' => {'item' => { 'callback_url' => '/presto/receive/add_item', 'id' => id.to_s }} }
payload = { 'action' => 'audio', 'data' => {'is_shortcircuited_search_result_callback' => true, 'item' => { 'callback_url' => '/presto/receive/add_item', 'id' => id.to_s }} }
Bot::Alegre.stubs(:process_alegre_callback).returns({})
post :index, params: { name: :alegre, token: CheckConfig.get('alegre_token') }.merge(payload)
assert_equal '200', response.code
assert_match /success/, response.body
end

test "should process Alegre callback webhook with is_search_result_callback" do
CheckSentry.expects(:notify).once
id = random_number
payload = { 'action' => 'audio', 'data' => {'is_search_result_callback' => true, 'item' => { 'callback_url' => '/presto/receive/add_item', 'id' => id.to_s }} }
Bot::Alegre.stubs(:process_alegre_callback).returns({})
post :index, params: { name: :alegre, token: CheckConfig.get('alegre_token') }.merge(payload)
assert_equal '200', response.code
Expand Down

0 comments on commit 3cd7b85

Please sign in to comment.