def test_remove_handler(self): w = Wryte(name=str(uuid.uuid4())) assert len(w.list_handlers()) == 1 assert w.list_handlers() == ['_console'] w.remove_handler('_console') assert len(w.list_handlers()) == 0 assert w.list_handlers() == []
def test_add_handler(self): w = Wryte(name=str(uuid.uuid4()), bare=True) assert len(w.list_handlers()) == 0 name = w.add_handler(handler=logging.StreamHandler(sys.stdout), name='_json', formatter='json', level='debug') assert len(w.list_handlers()) == 1 assert w.list_handlers() == ['_json'] assert name == '_json' assert w.logger.getEffectiveLevel() == 10
def test_add_handler_bad_level(self): w = Wryte(name=str(uuid.uuid4()), bare=True) w.add_handler(handler=logging.StreamHandler(sys.stdout), name='_json', formatter='json', level='BOOBOO') assert len(w.list_handlers()) == 0
def test_remove_nonexisting_handler(self): w = Wryte(name=str(uuid.uuid4())) w.remove_handler('banana') assert len(w.list_handlers()) == 1
def test_list_handlers_no_handlers_configured(self): w = Wryte(name=str(uuid.uuid4()), bare=True) assert len(w.list_handlers()) == 0 assert w.list_handlers() == []
def test_list_handlers(self): w = Wryte(name=str(uuid.uuid4())) assert len(w.list_handlers()) == 1 assert w.list_handlers() == ['_console']
def test_bare_handler(self): w = Wryte(name=str(uuid.uuid4()), bare=True) assert len(w.list_handlers()) == 0