Sfoglia il codice sorgente

Address review findings

Arthur 9 ore fa
parent
commit
a7d6ce734c
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  1. 6 0
      netbox/netbox/tests/test_middleware.py

+ 6 - 0
netbox/netbox/tests/test_middleware.py

@@ -181,3 +181,9 @@ class SentryNotFoundReportingTestCase(TestCase):
         self.assertEqual(response.status_code, 301)
         self.assertEqual(response.headers['Location'], '/api/status/')
         self.sentry_sdk.capture_message.assert_not_called()
+
+    def test_unsafe_api_request_without_slash_reported_to_sentry(self):
+        response = self.client.post('/api/status', data={}, content_type='application/json')
+
+        self.assertEqual(response.status_code, 404)
+        self.sentry_sdk.capture_message.assert_called_once_with('Page not found', level='error')