Skip to content

Commit

Permalink
fix fixtures'
Browse files Browse the repository at this point in the history
  • Loading branch information
DGaffney committed Oct 20, 2023
1 parent c093c04 commit c1d0da0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/controllers/webhooks_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,19 +233,19 @@ def setup
assert_match /ignored/, response.body
end

test "should process Alegre webhook" do
test "should process Alegre webhook zzz" do
CheckSentry.expects(:notify).never
redis = Redis.new(REDIS_CONFIG)
redis.del('foo')
payload = { 'action' => 'audio', 'data' => {'requested' => { 'id' => 'foo', 'context' => { 'project_media_id' => random_number } }} }
id = random_number
payload = { 'action' => 'audio', 'data' => {'requested' => { 'id' => 'foo', 'context' => { 'project_media_id' => id } }} }
assert_nil redis.lpop('alegre:webhook:foo')

post :index, params: { name: :alegre, token: CheckConfig.get('alegre_token') }.merge(payload)
response = JSON.parse(redis.lpop('alegre:webhook:foo'))
assert_equal 'foo', response.dig('requested', 'id')

travel_to Time.now.since(2.days)
assert_nil redis.lpop('alegre:webhook:foo')
assert_equal 'foo', response.dig('data', 'requested', 'id')
expectation = {"action"=>"index", "data"=>{"requested"=>{"context"=>{"project_media_id"=>id.to_s}, "id"=>"foo"}}, "token"=>"test", "name"=>"alegre", "controller"=>"api/v1/webhooks"}
assert_equal expectation, response
end

test "should report error if can't process Alegre webhook" do
Expand Down

0 comments on commit c1d0da0

Please sign in to comment.