func (s *ManagerTestSuite) TestList() { assert.Equal(s.T(), []string{}, s.manager.List()) l := logger_mock.New() assert.Nil(s.T(), s.manager.Register("mock", l)) assert.Equal(s.T(), []string{"mock"}, s.manager.List()) }
func (s *ManagerTestSuite) TestDisable() { // setup l := logger_mock.New() s.manager.Register("mock", l) // disable assert.Nil(s.T(), s.manager.Disable("mock")) s.testIsEnabled("mock", false, nil) // inexistent assert.NotNil(s.T(), s.manager.Disable("inexistent")) }
func (s *ManagerTestSuite) TestDeregister() { // setup l := logger_mock.New() s.manager.Register("mock", l) // deregister assert.Nil(s.T(), s.manager.Deregister("mock")) assert.Equal(s.T(), []string{}, s.manager.List()) // inexistent assert.NotNil(s.T(), s.manager.Deregister("inexistent")) }
func (s *ManagerTestSuite) TestRegister() { l := logger_mock.New() assert.Nil(s.T(), s.manager.Register("mock", l)) assert.Equal(s.T(), []string{"mock"}, s.manager.List()) s.testIsEnabled("mock", true, nil) // duplicate assert.Nil(s.T(), s.manager.Register("mock", l)) assert.Equal(s.T(), []string{"mock"}, s.manager.List()) s.testIsEnabled("mock", true, nil) // nil assert.NotNil(s.T(), s.manager.Register("mock", nil)) }
func (s *ManagerTestSuite) TestIsEnabled() { // setup l := logger_mock.New() s.manager.Register("mock", l) // enabled logger s.testIsEnabled("mock", true, nil) // disabled logger s.manager.Disable("mock") s.testIsEnabled("mock", false, nil) // inexistent logger s.testIsEnabled("inexistent", false, fmt.Errorf("error")) }
func (s *ManagerTestSuite) TestEnable() { // setup l := logger_mock.New() s.manager.Register("mock", l) // registered logger is enabled by default s.testIsEnabled("mock", true, nil) // enable a disabled logger s.manager.Disable("mock") assert.Nil(s.T(), s.manager.Enable("mock")) s.testIsEnabled("mock", true, nil) // inexistent assert.NotNil(s.T(), s.manager.Enable("inexistent")) }
func (s *LoggerTestSuite) TestNew() { l := mock.New() assert.NotNil(s.T(), l) }