Esempio n. 1
0
 def test_slog_with_scribe(self):
     mock = Mock()
     temp = douban.utils.slog.scribeclient
     douban.utils.slog.scribeclient = mock
     log('test', 'test-message')
     assert mock.send.called
     test_log = lambda x: log('test', x)
     test_log('tmsg')
     assert mock.send.called
     douban.utils.slog.scribeclient = temp
Esempio n. 2
0
 def test_slog_without_scribec(self):
     temp = douban.utils.slog.scribeclient
     douban.utils.slog.scribeclient = None
     with patch('sys.stderr') as mock_stderr:
         log('test', 'testmessage')
         assert mock_stderr.write.called
         test_log = lambda x: log('haha', x)
         test_log('tset_message')
         assert mock_stderr.write.called
     douban.utils.slog.scribeclient = temp