Example #1
0
    def test_normal_stop(self):
        upgrade_center = UpgradeCenter()
        normal_worker = NormalWorker()
        upgrade_center.register(normal_worker)
        upgrade_center.start()
        upgrade_center.stop()

        self.assertTrue(normal_worker.is_stopped, 'Worker is stopped')
Example #2
0
 def test_more_workers_stop(self):
     upgrade_center = UpgradeCenter()
     normal_worker1 = NormalWorker()
     normal_worker2 = NormalWorker()
     upgrade_center.register(normal_worker1)
     upgrade_center.register(normal_worker2)
     upgrade_center.start()
     upgrade_center.stop()
     self.assertEqual(
         [normal_worker1.is_stopped, normal_worker2.is_stopped],
         [True, True])