@@ -2,7 +2,7 @@ defmodule Sentry.PlugCaptureTest do
22 use ExUnit.Case
33 use Plug.Test
44
5- import Sentry.TestEnvironmentHelper
5+ import Sentry.TestHelpers
66 import ExUnit.CaptureLog
77
88 defmodule PhoenixController do
@@ -56,12 +56,12 @@ defmodule Sentry.PlugCaptureTest do
5656 Bypass . expect ( bypass , fn conn ->
5757 { :ok , body , conn } = Plug.Conn . read_body ( conn )
5858
59- _event = TestHelpers . decode_event_from_envelope! ( body )
59+ _event = decode_event_from_envelope! ( body )
6060
6161 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
6262 end )
6363
64- modify_env ( :sentry , dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
64+ modify_app_env ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
6565
6666 assert_raise ( Plug.Conn.WrapperError , "** (RuntimeError) Error" , fn ->
6767 conn ( :get , "/error_route" )
@@ -75,12 +75,12 @@ defmodule Sentry.PlugCaptureTest do
7575 Bypass . expect ( bypass , fn conn ->
7676 { :ok , body , conn } = Plug.Conn . read_body ( conn )
7777
78- _event = TestHelpers . decode_event_from_envelope! ( body )
78+ _event = decode_event_from_envelope! ( body )
7979
8080 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
8181 end )
8282
83- modify_env ( :sentry , dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
83+ modify_app_env ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
8484
8585 catch_throw (
8686 conn ( :get , "/throw_route" )
@@ -94,12 +94,12 @@ defmodule Sentry.PlugCaptureTest do
9494 Bypass . expect ( bypass , fn conn ->
9595 { :ok , body , conn } = Plug.Conn . read_body ( conn )
9696
97- _event = TestHelpers . decode_event_from_envelope! ( body )
97+ _event = decode_event_from_envelope! ( body )
9898
9999 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
100100 end )
101101
102- modify_env ( :sentry , dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
102+ modify_app_env ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
103103
104104 catch_exit (
105105 conn ( :get , "/exit_route" )
@@ -113,7 +113,7 @@ defmodule Sentry.PlugCaptureTest do
113113 Bypass . expect ( bypass , fn conn ->
114114 { :ok , body , conn } = Plug.Conn . read_body ( conn )
115115
116- event = TestHelpers . decode_event_from_envelope! ( body )
116+ event = decode_event_from_envelope! ( body )
117117
118118 assert event . request [ "url" ] == "http://www.example.com/error_route"
119119 assert event . request [ "method" ] == "GET"
@@ -122,7 +122,7 @@ defmodule Sentry.PlugCaptureTest do
122122 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
123123 end )
124124
125- modify_env ( :sentry , dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
125+ modify_app_env ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
126126
127127 assert_raise ( Plug.Conn.WrapperError , "** (RuntimeError) Error" , fn ->
128128 conn ( :get , "/error_route" )
@@ -136,12 +136,12 @@ defmodule Sentry.PlugCaptureTest do
136136 Bypass . expect_once ( bypass , fn conn ->
137137 { :ok , body , conn } = Plug.Conn . read_body ( conn )
138138
139- _event = TestHelpers . decode_event_from_envelope! ( body )
139+ _event = decode_event_from_envelope! ( body )
140140
141141 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
142142 end )
143143
144- modify_env ( :sentry , dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
144+ modify_app_env ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
145145
146146 assert_raise ( Plug.Conn.WrapperError , "** (RuntimeError) Error" , fn ->
147147 conn ( :get , "/error_route" )
@@ -165,7 +165,7 @@ defmodule Sentry.PlugCaptureTest do
165165 Bypass . expect ( bypass , fn conn ->
166166 { :ok , body , conn } = Plug.Conn . read_body ( conn )
167167
168- event = TestHelpers . decode_event_from_envelope! ( body )
168+ event = decode_event_from_envelope! ( body )
169169
170170 assert event . culprit == "Sentry.PlugCaptureTest.PhoenixController.error/2"
171171
@@ -175,7 +175,7 @@ defmodule Sentry.PlugCaptureTest do
175175 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
176176 end )
177177
178- modify_env ( :sentry ,
178+ modify_app_env (
179179 dsn: "http://public:secret@localhost:#{ bypass . port } /1" ,
180180 "#{ __MODULE__ . PhoenixEndpoint } ": [
181181 render_errors: [ view: Sentry.ErrorView , accepts: ~w( html) ]
@@ -198,14 +198,14 @@ defmodule Sentry.PlugCaptureTest do
198198 Bypass . expect ( bypass , fn conn ->
199199 { :ok , body , conn } = Plug.Conn . read_body ( conn )
200200
201- event = TestHelpers . decode_event_from_envelope! ( body )
201+ event = decode_event_from_envelope! ( body )
202202
203203 assert event . culprit == "Sentry.PlugCaptureTest.PhoenixController.exit/2"
204204 assert event . message == "Uncaught exit - :test"
205205 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
206206 end )
207207
208- modify_env ( :sentry ,
208+ modify_app_env (
209209 dsn: "http://public:secret@localhost:#{ bypass . port } /1" ,
210210 "#{ __MODULE__ . PhoenixEndpoint } ": [
211211 render_errors: [ view: Sentry.ErrorView , accepts: ~w( html) ]
@@ -225,14 +225,14 @@ defmodule Sentry.PlugCaptureTest do
225225 Bypass . expect ( bypass , fn conn ->
226226 { :ok , body , conn } = Plug.Conn . read_body ( conn )
227227
228- event = TestHelpers . decode_event_from_envelope! ( body )
228+ event = decode_event_from_envelope! ( body )
229229
230230 assert event . culprit == "Sentry.PlugCaptureTest.PhoenixController.throw/2"
231231 assert event . message == "Uncaught throw - :test"
232232 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
233233 end )
234234
235- modify_env ( :sentry ,
235+ modify_app_env (
236236 dsn: "http://public:secret@localhost:#{ bypass . port } /1" ,
237237 "#{ __MODULE__ . PhoenixEndpoint } ": [
238238 render_errors: [ view: Sentry.ErrorView , accepts: ~w( html) ]
@@ -269,7 +269,7 @@ defmodule Sentry.PlugCaptureTest do
269269 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
270270 end )
271271
272- modify_env ( :sentry , dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
272+ modify_app_env ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
273273
274274 start_supervised! ( PhoenixEndpoint )
275275
@@ -280,7 +280,7 @@ defmodule Sentry.PlugCaptureTest do
280280 end
281281
282282 assert_receive { ^ ref , sentry_body }
283- event = TestHelpers . decode_event_from_envelope! ( sentry_body )
283+ event = decode_event_from_envelope! ( sentry_body )
284284
285285 assert event . culprit == "Sentry.PlugCaptureTest.PhoenixController.action_clause_error/2"
286286 assert [ exception ] = event . exception
@@ -295,12 +295,12 @@ defmodule Sentry.PlugCaptureTest do
295295 Bypass . expect ( bypass , fn conn ->
296296 { :ok , body , conn } = Plug.Conn . read_body ( conn )
297297
298- _event = TestHelpers . decode_event_from_envelope! ( body )
298+ _event = decode_event_from_envelope! ( body )
299299
300300 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
301301 end )
302302
303- modify_env ( :sentry ,
303+ modify_app_env (
304304 dsn: "http://public:secret@localhost:#{ bypass . port } /1" ,
305305 "#{ __MODULE__ . PhoenixEndpoint } ": [
306306 render_errors: [ view: Sentry.ErrorView , accepts: ~w( html) ]
@@ -332,12 +332,12 @@ defmodule Sentry.PlugCaptureTest do
332332 Bypass . expect ( bypass , fn conn ->
333333 { :ok , body , conn } = Plug.Conn . read_body ( conn )
334334
335- _event = TestHelpers . decode_event_from_envelope! ( body )
335+ _event = decode_event_from_envelope! ( body )
336336
337337 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
338338 end )
339339
340- modify_env ( :sentry , dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
340+ modify_app_env ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
341341
342342 conn = conn ( :get , "/error_route" )
343343
@@ -358,12 +358,12 @@ defmodule Sentry.PlugCaptureTest do
358358
359359 Bypass . expect ( bypass , fn conn ->
360360 { :ok , body , conn } = Plug.Conn . read_body ( conn )
361- event = TestHelpers . decode_event_from_envelope! ( body )
361+ event = decode_event_from_envelope! ( body )
362362 assert event . culprit == "Sentry.PlugCaptureTest.PhoenixController.assigns/2"
363363 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
364364 end )
365365
366- modify_env ( :sentry ,
366+ modify_app_env (
367367 dsn: "http://public:secret@localhost:#{ bypass . port } /1" ,
368368 "#{ __MODULE__ . PhoenixEndpoint } ": [
369369 render_errors: [ view: Sentry.ErrorView , accepts: ~w( html) ]
0 commit comments