From 95c704f1275b8d1b1485e8bb6bbe2ad1f779dcd6 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Sun, 29 Mar 2015 12:00:41 -0700 Subject: [PATCH] Remove deprecated manual configuration for remotes --- CHANGES | 1 + raven/base.py | 10 ++++------ tests/base/tests.py | 24 ++++++------------------ tests/contrib/django/tests.py | 4 +--- tests/handlers/logging/tests.py | 10 ++-------- 5 files changed, 14 insertions(+), 35 deletions(-) diff --git a/CHANGES b/CHANGES index 81672d20..ae6a4caf 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ Version 5.3.0 * The UDP transport has been removed. * The integrated Sentry+Django client has been removed. This is now part of Sentry core. +* Server configuration *must* now be specified with a DSN. Version 5.2.0 ------------- diff --git a/raven/base.py b/raven/base.py index ff4fa3d3..0b48de44 100644 --- a/raven/base.py +++ b/raven/base.py @@ -197,12 +197,10 @@ class Client(object): secret_key = dsn_config['SENTRY_SECRET_KEY'] transport_options = dsn_config.get('SENTRY_TRANSPORT_OPTIONS', {}) else: - if o.get('servers'): - warnings.warn('Manually configured connections are deprecated. Switch to a DSN.', DeprecationWarning) - servers = o.get('servers') - project = o.get('project') - public_key = o.get('public_key') - secret_key = o.get('secret_key') + servers = () + project = None + public_key = None + secret_key = None transport_options = {} self.dsns[dsn] = servers, public_key, secret_key, project, transport_options diff --git a/tests/base/tests.py b/tests/base/tests.py index c687965a..9af78d10 100644 --- a/tests/base/tests.py +++ b/tests/base/tests.py @@ -170,16 +170,13 @@ class ClientTest(TestCase): def test_send(self, time, send_remote): time.return_value = 1328055286.51 client = Client( - servers=['http://example.com'], - public_key='public', - secret_key='secret', - project=1, + dsn='http://public:secret@example.com/1', ) client.send(**{ 'foo': 'bar', }) send_remote.assert_called_once_with( - url='http://example.com', + url='http://example.com/api/1/store/', data=six.b('eJyrVkrLz1eyUlBKSixSqgUAIJgEVA=='), headers={ 'User-Agent': 'raven-python/%s' % (raven.VERSION,), @@ -197,16 +194,13 @@ class ClientTest(TestCase): def test_send_with_auth_header(self, time, send_remote): time.return_value = 1328055286.51 client = Client( - servers=['http://example.com'], - public_key='public', - secret_key='secret', - project=1, + dsn='http://public:secret@example.com/1', ) client.send(auth_header='foo', **{ 'foo': 'bar', }) send_remote.assert_called_once_with( - url='http://example.com', + url='http://example.com/api/1/store/', data=six.b('eJyrVkrLz1eyUlBKSixSqgUAIJgEVA=='), headers={ 'User-Agent': 'raven-python/%s' % (raven.VERSION,), @@ -220,10 +214,7 @@ class ClientTest(TestCase): def test_raise_exception_on_send_error(self, should_try, _send_remote): should_try.return_value = True client = Client( - servers=['sync+http://example.com'], - public_key='public', - secret_key='secret', - project=1, + dsn='sync+http://public:secret@example.com/1', ) # Test for the default behaviour in which a send error is handled by the client @@ -234,10 +225,7 @@ class ClientTest(TestCase): # Test for the case in which a send error is raised to the calling frame. client = Client( - servers=['sync+http://example.com'], - public_key='public', - secret_key='secret', - project=1, + dsn='sync+http://public:secret@example.com/1', raise_send_errors=True, ) with self.assertRaises(Exception): diff --git a/tests/contrib/django/tests.py b/tests/contrib/django/tests.py index 48a60a32..db9bf408 100644 --- a/tests/contrib/django/tests.py +++ b/tests/contrib/django/tests.py @@ -579,9 +579,7 @@ class DjangoLoggingTest(TestCase): class CeleryIsolatedClientTest(TestCase): def setUp(self): self.client = CeleryClient( - servers=['http://example.com'], - public_key='public', - secret_key='secret', + dsn='sync+http://public:secret@example.com/1' ) @mock.patch('raven.contrib.django.celery.send_raw') diff --git a/tests/handlers/logging/tests.py b/tests/handlers/logging/tests.py index 54fc23de..9bdbf621 100644 --- a/tests/handlers/logging/tests.py +++ b/tests/handlers/logging/tests.py @@ -69,10 +69,7 @@ class LoggingIntegrationTest(TestCase): should_try.return_value = True # Test for the default behaviour in which an exception is handled by the client or handler client = Client( - servers=['sync+http://example.com'], - public_key='public', - secret_key='secret', - project=1, + dsn='sync+http://public:secret@example.com/1', ) handler = SentryHandler(client) _send_remote.side_effect = Exception() @@ -82,10 +79,7 @@ class LoggingIntegrationTest(TestCase): # Test for the case in which a send error is raised to the calling frame. client = Client( - servers=['sync+http://example.com'], - public_key='public', - secret_key='secret', - project=1, + dsn='sync+http://public:secret@example.com/1', raise_send_errors=True, ) handler = SentryHandler(client)