def test_log_with_scribe(self):
     mock = Mock()
     temp = douban.utils.slog.scribeclient
     douban.utils.slog.scribeclient = mock
     from douban.sqlstore import slog
     slog('test-message')
     ok_(mock.send.called, 'Does not use scribeclient')
     douban.utils.slog.scribeclient = temp
Example #2
0
 def test_log_with_scribe(self):
     mock = Mock()
     temp = douban.utils.slog.scribeclient
     douban.utils.slog.scribeclient = mock
     from douban.sqlstore import slog
     slog('test-message')
     ok_(mock.send.called, 'Does not use scribeclient')
     douban.utils.slog.scribeclient = temp
 def test_log_without_scribe(self):
     temp = douban.utils.slog.scribeclient
     douban.utils.slog.scribeclient = None
     from douban.sqlstore import slog
     with patch('sys.stderr') as mock_stderr:
         slog('testmessage')
         ok_(mock_stderr.write.called, 'Log is not printed to stderr')
     douban.utils.slog.scribeclient = temp
Example #4
0
 def test_log_without_scribe(self):
     temp = douban.utils.slog.scribeclient
     douban.utils.slog.scribeclient = None
     from douban.sqlstore import slog
     with patch('sys.stderr') as mock_stderr:
         slog('testmessage')
         ok_(mock_stderr.write.called, 'Log is not printed to stderr')
     douban.utils.slog.scribeclient = temp