Пример #1
0
 def test_http_404_error(self):
     client = OpbeatClient(secret_token='TOKEN',
                           organization_id='ORG_ID',
                           app_id='APP_ID')
     with self.assertRaises(ClientConnectionError) as cm:
         client.post(settings.DEPLOYMENT_API_URI, {})
     self.assertEqual(cm.exception.args[0], 404)
Пример #2
0
    def test_client_connection_error(self):
        client = OpbeatClient(secret_token='TOKEN',
                              organization_id='ORG_ID',
                              app_id='APP_ID',
                              server='http://no-resolve.localhost')

        with self.assertRaises(ClientConnectionError):
            client.post('/', {})
Пример #3
0
    def test_client_timeout(self):
        client = OpbeatClient(secret_token='TOKEN',
                              organization_id='ORG_ID',
                              app_id='APP_ID',
                              timeout=0)
        with self.assertRaises(ClientConnectionError) as cm:
            client.post('/', {})

        self.assertIn('timeout', str(cm.exception))