66from raven .conf import setup_logging
77from raven .conf .remote import RemoteConfig
88from raven .exceptions import InvalidDsn
9+ from raven .utils import get_auth_header
910from raven .utils .testutils import TestCase
1011
1112
@@ -80,6 +81,22 @@ def test_options(self):
8081 assert res .secret_key == 'bar'
8182 assert res .options == {'timeout' : '1' }
8283
84+ def test_no_secret_key (self ):
85+ dsn = 'https://[email protected] /1' 86+ res = RemoteConfig .from_string (dsn )
87+ assert res .project == '1'
88+ assert res .base_url == 'https://sentry.local'
89+ assert res .store_endpoint == 'https://sentry.local/api/1/store/'
90+ assert res .public_key == 'foo'
91+ assert res .secret_key is None
92+ assert res .options == {}
93+
94+ assert get_auth_header (protocol = 7 , timestamp = 42 ,
95+ client = 'raven-python/1.0' ,
96+ api_key = res .public_key ) == (
97+ 'Sentry sentry_timestamp=42, sentry_client=raven-python/1.0, '
98+ 'sentry_version=7, sentry_key=foo' )
99+
83100 def test_missing_netloc (self ):
84101 dsn = 'https://foo:bar@/1'
85102 self .assertRaises (InvalidDsn , RemoteConfig .from_string , dsn )
@@ -92,10 +109,6 @@ def test_missing_public_key(self):
92109 dsn = 'https://:[email protected] ' 93110 self .assertRaises (InvalidDsn , RemoteConfig .from_string , dsn )
94111
95- def test_missing_secret_key (self ):
96- 97- self .assertRaises (InvalidDsn , RemoteConfig .from_string , dsn )
98-
99112 def test_invalid_scheme (self ):
100113 dsn = 'ftp://foo:[email protected] /1' 101114 self .assertRaises (InvalidDsn , RemoteConfig .from_string , dsn )
0 commit comments