class JobControllerTestCase(TestCase): @setup def setup_controller(self): self.jobs = [Turtle(), Turtle(), Turtle()] self.mcp = Turtle(get_jobs=lambda: self.jobs) self.controller = JobController(self.mcp) def test_disable_all(self): self.controller.disable_all() for job in self.jobs: assert_call(job.disable, 0) def test_enable_all(self): self.controller.enable_all() for job in self.jobs: assert_call(job.enable, 0)
class JobControllerTestCase(TestCase): @setup def setup_controller(self): self.jobs = [mock.create_autospec(job.JobScheduler)] self.mcp = mock.create_autospec(mcp.MasterControlProgram) self.controller = JobController(self.mcp) def test_disable_all(self): self.mcp.get_jobs.return_value = self.jobs self.controller.disable_all() self.mcp.get_jobs.assert_called_with() for job in self.jobs: job.disable.assert_called_with() def test_enable_all(self): self.mcp.get_jobs.return_value = self.jobs self.controller.enable_all() self.mcp.get_jobs.assert_called_with() for job in self.jobs: job.enable.assert_called_with()
def setup_controller(self): self.jobs = [Turtle(), Turtle(), Turtle()] self.mcp = Turtle(get_jobs=lambda: self.jobs) self.controller = JobController(self.mcp)
def setup_controller(self): self.jobs = [mock.create_autospec(job.JobScheduler)] self.mcp = mock.create_autospec(mcp.MasterControlProgram) self.controller = JobController(self.mcp)