示例#1
0
 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)
示例#2
0
 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)
示例#3
0
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)
示例#4
0
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)
示例#5
0
 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)