Пример #1
0
 def test_notify_changes_tail_method(self):
     throttle_time = 0
     context = TailContext(throttle_time)
     self.assertTrue(isinstance(context.tail_method, TailMultiLineMethod))
     slow_down = notifications.SlowDown(context)
     slow_down.notify(WarningMessage(), DummyLog())
     self.assertTrue(isinstance(context.tail_method, TailOneLineMethod))
Пример #2
0
 def test_notify_no_change_context(self):
     throttle_time = 0
     context = TailContext(throttle_time)
     self.assertTrue(isinstance(context.tail_method, TailMultiLineMethod))
     slow_down = notifications.SlowDown(context)
     slow_down.notify(NormalMessage(), DummyLog())
     self.assertFalse(slow_down.triggered)
Пример #3
0
 def test_notify_back_to_default_after_1_tails(self):
     throttle_time = 0
     context = TailContext(throttle_time)
     self.assertTrue(isinstance(context.tail_method, TailMultiLineMethod))
     slow_down = notifications.SlowDown(context)
     notifications.SlowDown.MAX_COUNT = 1
     slow_down.notify(WarningMessage(), DummyLog())
     self.assertTrue(isinstance(context.tail_method, TailOneLineMethod))
     slow_down.notify(NormalMessage(), DummyLog())
     slow_down.notify(NormalMessage(), DummyLog())
     self.assertTrue(isinstance(context.tail_method, TailMultiLineMethod))
Пример #4
0
 def test_instantiates(self):
     throttle_time = 0
     context = TailContext(throttle_time)
     slow_down = notifications.SlowDown(context)
     self.assertTrue(isinstance(slow_down, notifications.SlowDown))
Пример #5
0
 def test_get_trace(self):
     throttle_time = 0
     context = TailContext(throttle_time, default_tail_method=TailMethod)
     trace = context.get_trace(DummyLog())
     self.assertEqual(trace, "hi")
Пример #6
0
 def test_changes_tail_method(self):
     throttle_time = 0
     context = TailContext(throttle_time, default_tail_method=TailMethod)
     context.change_tail_method(OtherTailMethod())
     self.assertTrue(isinstance(context.tail_method, OtherTailMethod))
Пример #7
0
 def test_instantiates(self):
     throttle_time = 0
     context = TailContext(throttle_time, default_tail_method=TailMethod)
     self.assertTrue(isinstance(context, TailContext))