Skip to content

Commit c8b92a1

Browse files
committed
add test for relay endpoints
1 parent 591726f commit c8b92a1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/sentry/middleware/test_reporting_endpoint.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from unittest.mock import MagicMock, patch
2+
13
from django.http import HttpResponse
24
from django.test import RequestFactory
35

@@ -30,3 +32,14 @@ def test_obeys_option(self) -> None:
3032
response = self.middleware.process_response(request, HttpResponse())
3133

3234
assert response.get("Reporting-Endpoints") is None
35+
36+
@patch("src.sentry.middleware.reporting_endpoint.options.get")
37+
def test_no_options_check_in_relay_endpoints(self, mock_options_get: MagicMock) -> None:
38+
with override_options(
39+
{"issues.browser_reporting.reporting_endpoints_header_enabled": True}
40+
):
41+
request = self.factory.get("/api/0/relays/register/challenge/")
42+
response = self.middleware.process_response(request, HttpResponse())
43+
44+
mock_options_get.assert_not_called()
45+
assert response.get("Reporting-Endpoints") is None

0 commit comments

Comments
 (0)