def test_log_when_debug_is_false(conf, datetime, find_event, tasks): conf.getsetting.return_value = False core.cleanup_handlers() datetime.now.return_value = 'tea time' eventlib.log('app.Event') tasks.process_task.delay.assert_called_once_with('app.Event', ejson.dumps({ '__ip_address__': '0.0.0.0', '__datetime__': 'tea time', }))
def test_log_when_debug_is_false(datetime, find_event, tasks): conf.DEBUG = False core.cleanup_handlers() datetime.now.return_value = 'tea time' eventlib.log('app.Event') tasks.process_task.delay.assert_called_once_with( 'app.Event', ejson.dumps({ '__ip_address__': '0.0.0.0', '__datetime__': 'tea time', }))
def test_log(find_event, process, datetime): conf.DEBUG = True core.cleanup_handlers() datetime.now.return_value = 'tea time' event_cls = Mock() find_event.return_value = event_cls data = {'name': 'Event System', 'code': 42} eventlib.log('app.Event', data) find_event.assert_called_once_with('app.Event') event_cls.assert_called_once_with('app.Event', data) event_cls.return_value.validate.assert_called_once() process.assert_called_once_with('app.Event', ejson.dumps(data))
def test_log(conf, find_event, process, datetime): conf.getsetting.return_value = True core.cleanup_handlers() datetime.now.return_value = 'tea time' event_cls = Mock() find_event.return_value = event_cls data = {'name': 'Event System', 'code': 42} eventlib.log('app.Event', data) find_event.assert_called_once_with('app.Event') event_cls.assert_called_once_with('app.Event', data) event_cls.return_value.validate.assert_called_once() process.assert_called_once_with('app.Event', ejson.dumps(data))
def test_log_insert_datetime(find_event, process, datetime): conf.DEBUG = True datetime.now.return_value = 'tea time' data = {'name': 'Event System', 'code': 42} eventlib.log('app.Event', data) data['__datetime__'].should.be.equals('tea time')
def test_log_insert_datetime(conf, find_event, process, datetime): conf.getsetting.return_value = True datetime.now.return_value = 'tea time' data = {'name': 'Event System', 'code': 42} eventlib.log('app.Event', data) data['__datetime__'].should.be.equals('tea time')