def setUp(self): """ Unit test setup """ LogMessage.objects.all().delete() self.post_data = { 'levelno': '10', # integer NOT NULL 'levelname': 'DEBUG', # varchar(255) NOT NULL 'name': 'logger name', # varchar(255) NOT NULL 'module': 'unit test', # varchar(255) NOT NULL 'filename': 'tests.py', # varchar(255) NOT NULL 'pathname': 'plugins/logger', # varchar(255) NOT NULL 'funcName': 'setUp', # varchar(255) NOT NULL 'lineno': '25', # integer NOT NULL 'msg': 'debug message', # longtext NOT NULL 'exc_info': 'None', # longtext NULL 'exc_text': 'None', # longtext NULL 'args': '()', # longtext NULL 'threadName': 'ThreadName', # varchar(255) NOT NULL 'thread': '987.65', # double precision NOT NULL 'created': '432.10', # double precision NOT NULL, 'process': '24680', # integer NOT NULL 'relativeCreated': '135.79', # double precision NOT NULL 'msecs': '123.456', # double precision NOT NULL 'userDefinedId': WORKER_ID, } self.meta_data = { 'REMOTE_ADDR': '127.0.0.1', 'REMOTE_HOST': 'localhost', } request = HttpRequest() request.method = 'POST' request.POST = self.post_data request.META = self.meta_data create_message(request, SERVICENAME, RUN_ID)
def emit(self, record): """ Stores the message in db by calling create_message() directly @type record: C{logging.LogRecord} @param record: LogRecord object from pythons logging module """ meta_data = { 'REMOTE_ADDR' : '127.0.0.1', 'REMOTE_HOST' : gethostname(), } request = HttpRequest() request.method = 'POST' request.POST = record.__dict__ request.META = meta_data try: create_message(request, servicename = "ots", run_id=self.testrun_id) except Exception, error: print("error in LocalHttpHandler, testrun %s" % self.testrun_id) print error
def setUp(self): """ Unit test setup """ LogMessage.objects.all().delete() self.post_data = { 'levelno' : '10', # integer NOT NULL 'levelname' : 'DEBUG', # varchar(255) NOT NULL 'name' : 'logger name', # varchar(255) NOT NULL 'module' : 'unit test', # varchar(255) NOT NULL 'filename' : 'tests.py', # varchar(255) NOT NULL 'pathname' : 'plugins/logger', # varchar(255) NOT NULL 'funcName' : 'setUp', # varchar(255) NOT NULL 'lineno' : '25', # integer NOT NULL 'msg' : 'debug message', # longtext NOT NULL 'exc_info' : 'None', # longtext NULL 'exc_text' : 'None', # longtext NULL 'args' : '()', # longtext NULL 'threadName' : 'ThreadName', # varchar(255) NOT NULL 'thread' : '987.65', # double precision NOT NULL 'created' : '432.10', # double precision NOT NULL, 'process' : '24680', # integer NOT NULL 'relativeCreated' : '135.79', # double precision NOT NULL 'msecs' : '123.456', # double precision NOT NULL 'userDefinedId' : WORKER_ID, } self.meta_data = { 'REMOTE_ADDR' : '127.0.0.1', 'REMOTE_HOST' : 'localhost', } request = HttpRequest() request.method = 'POST' request.POST = self.post_data request.META = self.meta_data create_message(request, SERVICENAME, RUN_ID)