Пример #1
0
 def test_options(self):
     dsn = "http://*****:*****@sentry.local/1?timeout=1"
     res = RemoteConfig.from_string(dsn)
     assert res.project == "1"
     assert res.base_url == "http://sentry.local"
     assert res.store_endpoint == "http://sentry.local/api/1/store/"
     assert res.public_key == "foo"
     assert res.secret_key == "bar"
     assert res.options == {"timeout": "1"}
Пример #2
0
 def test_options(self):
     dsn = 'http://*****:*****@sentry.local/1?timeout=1'
     res = RemoteConfig.from_string(dsn)
     assert res.project == '1'
     assert res.base_url == 'http://sentry.local'
     assert res.store_endpoint == 'http://sentry.local/api/1/store/'
     assert res.public_key == 'foo'
     assert res.secret_key == 'bar'
     assert res.options == {'timeout': '1'}
Пример #3
0
 def test_https_with_port(self):
     dsn = "https://*****:*****@sentry.local:9000/app/1"
     res = RemoteConfig.from_string(dsn)
     assert res.project == "1"
     assert res.base_url == "https://sentry.local:9000/app"
     assert res.store_endpoint == "https://sentry.local:9000/app/api/1/store/"
     assert res.public_key == "foo"
     assert res.secret_key == "bar"
     assert res.options == {}
Пример #4
0
 def test_options(self):
     dsn = 'http://*****:*****@sentry.local/1?timeout=1'
     res = RemoteConfig.from_string(dsn)
     assert res.project == '1'
     assert res.base_url == 'http://sentry.local'
     assert res.store_endpoint == 'http://sentry.local/api/1/store/'
     assert res.public_key == 'foo'
     assert res.secret_key == 'bar'
     assert res.options == {'timeout': '1'}
Пример #5
0
 def test_https_with_port(self):
     dsn = 'https://*****:*****@sentry.local:9000/app/1'
     res = RemoteConfig.from_string(dsn)
     assert res.project == '1'
     assert res.base_url == 'https://sentry.local:9000/app'
     assert res.store_endpoint == 'https://sentry.local:9000/app/api/1/store/'
     assert res.public_key == 'foo'
     assert res.secret_key == 'bar'
     assert res.options == {}
Пример #6
0
 def test_https_with_port(self):
     dsn = 'https://*****:*****@sentry.local:9000/app/1'
     res = RemoteConfig.from_string(dsn)
     assert res.project == '1'
     assert res.base_url == 'https://sentry.local:9000/app'
     assert res.store_endpoint == 'https://sentry.local:9000/app/api/1/store/'
     assert res.public_key == 'foo'
     assert res.secret_key == 'bar'
     assert res.options == {}
Пример #7
0
 def set_dsn(self, dsn = None, transport = None):
     if not dsn and os.environ.get('SENTRY_DSN'):
         msg = "Configuring Raven from environment variable 'SENTRY_DSN'"
         self.logger.debug(msg)
         dsn = os.environ['SENTRY_DSN']
     if dsn not in self._transport_cache:
         if not dsn:
             result = RemoteConfig(transport=transport)
         else:
             result = RemoteConfig.from_string(dsn, transport=transport, transport_registry=self._registry)
         self._transport_cache[dsn] = result
         self.remote = result
     else:
         self.remote = self._transport_cache[dsn]
     self.logger.debug('Configuring Raven for host: {0}'.format(self.remote))
Пример #8
0
    def test_no_secret_key(self):
        dsn = 'https://[email protected]/1'
        res = RemoteConfig.from_string(dsn)
        assert res.project == '1'
        assert res.base_url == 'https://sentry.local'
        assert res.store_endpoint == 'https://sentry.local/api/1/store/'
        assert res.public_key == 'foo'
        assert res.secret_key is None
        assert res.options == {}
        assert res.is_active()

        assert get_auth_header(protocol=7, timestamp=42,
                               client='raven-python/1.0',
                               api_key=res.public_key) == (
            'Sentry sentry_timestamp=42, sentry_client=raven-python/1.0, '
            'sentry_version=7, sentry_key=foo')
Пример #9
0
    def test_no_secret_key(self):
        dsn = 'https://[email protected]/1'
        res = RemoteConfig.from_string(dsn)
        assert res.project == '1'
        assert res.base_url == 'https://sentry.local'
        assert res.store_endpoint == 'https://sentry.local/api/1/store/'
        assert res.public_key == 'foo'
        assert res.secret_key is None
        assert res.options == {}

        assert get_auth_header(
            protocol=7,
            timestamp=42,
            client='raven-python/1.0',
            api_key=res.public_key) == (
                'Sentry sentry_timestamp=42, sentry_client=raven-python/1.0, '
                'sentry_version=7, sentry_key=foo')
Пример #10
0
    def set_dsn(self, dsn=None, transport=None):
        if dsn is None and os.environ.get("SENTRY_DSN"):
            msg = "Configuring Raven from environment variable 'SENTRY_DSN'"
            self.logger.debug(msg)
            dsn = os.environ["SENTRY_DSN"]

        if dsn not in self._transport_cache:
            if dsn is None:
                result = RemoteConfig(transport=transport)
            else:
                result = RemoteConfig.from_string(dsn, transport=transport, transport_registry=self._registry)
            self._transport_cache[dsn] = result
            self.remote = result
        else:
            self.remote = self._transport_cache[dsn]

        self.logger.debug("Configuring Raven for host: {0}".format(self.remote))