|
@@ -206,6 +206,28 @@ class SentryRemoteTest(TestCase):
|
|
|
resp = self._getWithReferer(kwargs, referer=None, protocol='4')
|
|
|
assert resp.status_code == 200, (resp.status_code, resp.get('X-Sentry-Error'))
|
|
|
|
|
|
+ @override_settings(SENTRY_ALLOW_ORIGIN='getsentry.com')
|
|
|
+ def test_correct_data_with_post_referer(self):
|
|
|
+ kwargs = {'message': 'hello'}
|
|
|
+ resp = self._postWithReferer(kwargs)
|
|
|
+ assert resp.status_code == 200, resp.content
|
|
|
+ instance = Event.objects.get()
|
|
|
+ assert instance.message == 'hello'
|
|
|
+
|
|
|
+ @override_settings(SENTRY_ALLOW_ORIGIN='getsentry.com')
|
|
|
+ def test_post_without_referer(self):
|
|
|
+ self.project.update_option('sentry:origins', '')
|
|
|
+ kwargs = {'message': 'hello'}
|
|
|
+ resp = self._postWithReferer(kwargs, referer=None, protocol='4')
|
|
|
+ assert resp.status_code == 403, (resp.status_code, resp.get('X-Sentry-Error'))
|
|
|
+
|
|
|
+ @override_settings(SENTRY_ALLOW_ORIGIN='*')
|
|
|
+ def test_post_without_referer_allowed(self):
|
|
|
+ self.project.update_option('sentry:origins', '')
|
|
|
+ kwargs = {'message': 'hello'}
|
|
|
+ resp = self._postWithReferer(kwargs, referer=None, protocol='4')
|
|
|
+ assert resp.status_code == 200, (resp.status_code, resp.get('X-Sentry-Error'))
|
|
|
+
|
|
|
def test_signature(self):
|
|
|
kwargs = {'message': 'hello'}
|
|
|
|