Skip to content

Commit 7597cfe

Browse files
committed
fix test
1 parent 028a542 commit 7597cfe

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/mix/sentry.send_test_event_test.exs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,19 @@ defmodule Mix.Tasks.Sentry.SendTestEventTest do
4848
"""
4949
end
5050

51-
test "handles :error when Sentry server is unreachable" do
52-
modify_env(:sentry, [dsn: "http://public:secret@localhost:0/1"])
51+
test "handles :error when Sentry server is failing" do
52+
bypass = Bypass.open
53+
Bypass.expect bypass, fn conn ->
54+
{:ok, _body, conn} = Plug.Conn.read_body(conn)
55+
Plug.Conn.resp(conn, 500, ~s<{"id": "340"}>)
56+
end
57+
modify_env(:sentry, [dsn: "http://public:secret@localhost:#{bypass.port}/1"])
5358
assert capture_log(fn ->
5459
assert capture_io(fn ->
5560
Mix.Tasks.Sentry.SendTestEvent.run([])
5661
end) == """
5762
Client configuration:
58-
server: http://localhost:0/api/1/store/
63+
server: http://localhost:#{bypass.port}/api/1/store/
5964
public_key: public
6065
secret_key: secret
6166
included_environments: [:test]

0 commit comments

Comments
 (0)