Skip to content

Commit

Permalink
disable HostAuthorization middleware for Sinatra testing
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahramadan committed Nov 18, 2024
1 parent 584a84a commit 93f4af1
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
class DeferredSinatraTestApp < Sinatra::Base
include NewRelic::TestHelpers::Exceptions

set :host_authorization, {permitted_hosts: []}
configure do
# display exceptions so we see what's going on
disable :show_exceptions
Expand Down
1 change: 1 addition & 0 deletions test/multiverse/suites/rails/rails3_app/my_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Application < Base
end

class SinatraTestApp < Sinatra::Base
set :host_authorization, {permitted_hosts: []}
get '/' do
raise 'Intentional error' if params['raise']

Expand Down
5 changes: 4 additions & 1 deletion test/multiverse/suites/sinatra/ignoring_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# frozen_string_literal: true

class SinatraIgnoreTestApp < Sinatra::Base
set :host_authorization, {permitted_hosts: []}
get '/record' do
request.path_info
end
Expand Down Expand Up @@ -224,6 +225,7 @@ def name_for_route(path)
class SinatraIgnoreItAllApp < Sinatra::Base
newrelic_ignore

set :host_authorization, {permitted_hosts: []}
get '/' do
request.path_info
end
Expand All @@ -250,7 +252,8 @@ def test_ignores_everything
class SinatraIgnoreApdexAndEndUserApp < Sinatra::Base
newrelic_ignore_apdex
newrelic_ignore_enduser


set :host_authorization, {permitted_hosts: []}
get '/' do
request.path_info
end
Expand Down
2 changes: 2 additions & 0 deletions test/multiverse/suites/sinatra/nested_middleware_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# frozen_string_literal: true

class MiddlewareApp < Sinatra::Base
set :host_authorization, {permitted_hosts: []}
get '/middle' do
'From the middlewarez'
end
Expand All @@ -11,6 +12,7 @@ class MiddlewareApp < Sinatra::Base
class MainApp < Sinatra::Base
use MiddlewareApp

set :host_authorization, {permitted_hosts: []}
get '/main' do
'mainly done'
end
Expand Down
1 change: 1 addition & 0 deletions test/multiverse/suites/sinatra/sinatra_classic_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

include NewRelic::TestHelpers::Exceptions

set :host_authorization, {permitted_hosts: []}
configure do
# display exceptions so we see what's going on
disable :show_exceptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# frozen_string_literal: true

class SinatraErrorTracingTestApp < Sinatra::Base
set :host_authorization, {permitted_hosts: []}
configure do
set :show_exceptions, false
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# frozen_string_literal: true

class SinatraTestApp < Sinatra::Base
set :host_authorization, {permitted_hosts: []}
get '/hello/:name' do |name|
name ||= 'world'
"hello #{name}"
Expand Down
1 change: 1 addition & 0 deletions test/multiverse/suites/sinatra/sinatra_modular_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
class SinatraModularTestApp < Sinatra::Base
include NewRelic::TestHelpers::Exceptions

set :host_authorization, {permitted_hosts: []}
configure do
# display exceptions so we see what's going on
disable :show_exceptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# frozen_string_literal: true

class SinatraParameterCaptureTestApp < Sinatra::Base
set :host_authorization, {permitted_hosts: []}
post '/capture_test' do
'capture test'
end
Expand Down
1 change: 1 addition & 0 deletions test/multiverse/suites/sinatra/sinatra_routes_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# frozen_string_literal: true

class SinatraRouteTestApp < Sinatra::Base
set :host_authorization, {permitted_hosts: []}
configure do
# create a condition (sintra's version of a before_filter) that returns the
# value that was passed into it.
Expand Down
1 change: 1 addition & 0 deletions test/multiverse/suites/sinatra_agent_disabled/shim_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require 'sinatra'

class MiddlewareApp < Sinatra::Base
set :host_authorization, {permitted_hosts: []}
get '/middle' do
'From the middlewarez'
end
Expand Down

0 comments on commit 93f4af1

Please sign in to comment.