Exemplo n.º 1
0
 def test_frameinfo(self):
     self.setUpClient(config={'errormator.report_local_vars': 'true'})
     test = 1
     b = {1: 'a', '2': 2, 'ccc': 'ddd'}
     obj = object()
     e_obj = client.Client({})
     unic = 'grzegżółka'
     a_list = [1, 2, 4, 5, 6, client.Client({}), 'dupa']
     long_val = 'imlong' * 100
     datetest = datetime.datetime.utcnow()
     try:
         raise Exception('Test Exception')
     except:
         traceback = get_current_traceback(skip=1, show_hidden_frames=True,
                                           ignore_system_exceptions=True)
     self.client.py_report(TEST_ENVIRON, traceback=traceback,
                           http_status=500)
     assert len(
         self.client.report_queue[0]['report_details'][0]['frameinfo'][0][
             'vars']) == 9
Exemplo n.º 2
0
    def pserve(self, *args, **kwargs):
        argv = sys.argv
        quiet = False
        ini_path = os.environ.get('ERRORMATOR_INI')
        config = {}
        if not ini_path:
            print "ERRORMATOR_INI variable is missing from environment/run cmd"
        else:
            config = client.get_config(path_to_config=ini_path)
        if not config.get('errormator'):
            print 'WARNING Could not instantiate the client properly'
        else:
            client.Client(config)
        from pyramid.scripts import pserve

        command = pserve.PServeCommand(argv[1:], quiet=quiet)
        return command.run()
Exemplo n.º 3
0
    def testini(cls, ini_name):
        print '\nCurrent directory: %s' % cwd
        ini_path = os.path.join(cwd, ini_name)
        config = client.get_config(path_to_config=ini_path)
        print 'INI file read - creating client'
        errormator_client = client.Client(config)
        print 'Client created, sending test entry'
        record = logging.makeLogRecord({
            'name': 'errormator.client.test',
            'message': 'Test entry'
        })

        errormator_client.py_log({}, [record])
        result = errormator_client.submit_data()
        if not result['logs']:
            print 'something went wrong, please check your API key'
            return False
        else:
            print 'Test entry transmitted correctly'
        return True
Exemplo n.º 4
0
 def setUpClient(self, config={}):
     self.client = client.Client(timing_conf)
Exemplo n.º 5
0
 def setUpClient(self, config={}):
     self.client = client.Client(config)
Exemplo n.º 6
0
 def setUpClient(self, config={}):
     self.client = client.Client(config)
     self.maxDiff = None
Exemplo n.º 7
0
 def setUpClient(self, config={'errormator.api_key': 'blargh!'}):
     self.client = client.Client(config)
Exemplo n.º 8
0
import unittest
import pprint
from errormator_client import client, make_errormator_middleware
from errormator_client.exceptions import get_current_traceback
from errormator_client.logger import register_logging
from errormator_client.wsgi import ErrormatorWSGIWrapper
from webob import Request

fname = pkg_resources.resource_filename('errormator_client',
                                        'templates/default_template.ini')
timing_conf = client.get_config(path_to_config=fname)
for k, v in timing_conf.iteritems():
    if 'errormator.timing' in k:
        timing_conf[k] = 0.0000001

client.Client(config=timing_conf)
from errormator_client.timing import local_timing, get_local_storage


def example_filter_callable(structure, section=None):
    return 'filtered-data'


TEST_ENVIRON = {
    'bfg.routes.matchdict': {'action': u'error'},
    'HTTP_COOKIE': 'country=US; http_referer="http://localhost:5000/"; test_group_id=5; sessionId=ec3ae5;',
    'SERVER_SOFTWARE': 'waitress',
    'SCRIPT_NAME': '',
    'REQUEST_METHOD': 'GET',
    'PATH_INFO': '/test/error',
    'SERVER_PROTOCOL': 'HTTP/1.1',
Exemplo n.º 9
0
 def setUpClient(self, config={}):
     timing_conf['errormator.api_key'] = '12345'
     self.client = client.Client(config)
     self.maxDiff = None
Exemplo n.º 10
0
 def setUpClient(self, config=None):
     if config is None:
         config = {'errormator.api_key': '12345'}
     self.client = client.Client(config)