def test_do_nothing_while_up(self, online, shutdown): online.return_value = True marchanddesable.tick(['192.168.0.1']) online.assert_any_called_with('192.168.0.1') self.assertFalse(shutdown.called)
def test_shutdown_after_exactly_5_minutes_when_alone(self, online, shutdown): online.return_value = True for i in range(20): self.time += 60 marchanddesable.tick(['192.168.0.1']) online.side_effect = lambda x: x == '8.8.8.8' marchanddesable.tick(['192.168.0.1']) self.time += 300 marchanddesable.tick(['192.168.0.1']) self.assertFalse(shutdown.called) self.time += 1 marchanddesable.tick(['192.168.0.1']) self.assertTrue(shutdown.called)