6
6
from raven .conf import setup_logging
7
7
from raven .conf .remote import RemoteConfig
8
8
from raven .exceptions import InvalidDsn
9
+ from raven .utils import get_auth_header
9
10
from raven .utils .testutils import TestCase
10
11
11
12
@@ -80,6 +81,22 @@ def test_options(self):
80
81
assert res .secret_key == 'bar'
81
82
assert res .options == {'timeout' : '1' }
82
83
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
+
83
100
def test_missing_netloc (self ):
84
101
dsn = 'https://foo:bar@/1'
85
102
self .assertRaises (InvalidDsn , RemoteConfig .from_string , dsn )
@@ -92,10 +109,6 @@ def test_missing_public_key(self):
92
109
dsn = 'https://:[email protected] '
93
110
self .assertRaises (InvalidDsn , RemoteConfig .from_string , dsn )
94
111
95
- def test_missing_secret_key (self ):
96
-
97
- self .assertRaises (InvalidDsn , RemoteConfig .from_string , dsn )
98
-
99
112
def test_invalid_scheme (self ):
100
113
dsn = 'ftp://foo:[email protected] /1'
101
114
self .assertRaises (InvalidDsn , RemoteConfig .from_string , dsn )
0 commit comments