def setup_adapter(self): action_runs = mock.MagicMock() action_runs.__iter__.return_value = iter([mock.Mock(), mock.Mock()]) self.job_run = mock.Mock( action_runs=action_runs, action_graph=mocks.MockActionGraph(), ) self.adapter = JobRunAdapter(self.job_run, include_action_runs=True)
class JobRunAdapterTestCase(TestCase): @setup def setup_adapter(self): action_runs = mocks.MockActionRunCollection(names=['one', 'two']) self.job_run = Turtle( action_runs=action_runs, action_graph=mocks.MockActionGraph()) self.adapter = JobRunAdapter(self.job_run, include_action_runs=True) def test__init__(self): assert self.adapter.include_action_runs def test_get_runs(self): runs = self.adapter.get_runs() assert_length(runs, 2) def test_get_runs_without_action_runs(self): self.adapter.include_action_runs = False assert_equal(self.adapter.get_runs(), None)
class JobRunAdapterTestCase(TestCase): @setup def setup_adapter(self): action_runs = mock.MagicMock() action_runs.__iter__.return_value = iter([mock.Mock(), mock.Mock()]) self.job_run = mock.Mock( action_runs=action_runs, action_graph=mocks.MockActionGraph()) self.adapter = JobRunAdapter(self.job_run, include_action_runs=True) def test__init__(self): assert self.adapter.include_action_runs def test_get_runs(self): with mock.patch('tron.api.adapter.ActionRunAdapter'): assert_length(self.adapter.get_runs(), 2) def test_get_runs_without_action_runs(self): self.adapter.include_action_runs = False assert_equal(self.adapter.get_runs(), None)
def setup_adapter(self): action_runs = mocks.MockActionRunCollection(names=['one', 'two']) self.job_run = Turtle( action_runs=action_runs, action_graph=mocks.MockActionGraph()) self.adapter = JobRunAdapter(self.job_run, include_action_runs=True)