def _do_test_parallel_commands__ready_two(first, second, result): cmd_mock_1 = flexmock(AtomicCmd(["ls"])) cmd_mock_1.should_receive('ready').and_return(first).at_least.once cmd_mock_2 = flexmock(AtomicCmd(["ls"])) cmd_mock_2.should_receive('ready').and_return(second) cmds = ParallelCmds([cmd_mock_1, cmd_mock_2]) assert_equal(cmds.ready(), result)
def test_parallel_commands__ready_single(value): cmd = AtomicCmd(["ls"]) cmd.ready = Mock() cmd.ready.return_value = value cmds = ParallelCmds([cmd]) assert cmds.ready() == value cmd.ready.assert_called()
def test_parallel_commands__ready_two(first, second, result): cmd_1 = AtomicCmd(["ls"]) cmd_1.ready = Mock() cmd_1.ready.return_value = first cmd_2 = AtomicCmd(["ls"]) cmd_2.ready = Mock() cmd_2.ready.return_value = second cmds = ParallelCmds([cmd_1, cmd_2]) assert cmds.ready() == result cmd_1.ready.assert_called() assert bool(first) == bool(cmd_2.ready.call_count)
def _do_test_parallel_commands__ready_single(value): cmd_mock = flexmock(AtomicCmd(["ls"])) cmd_mock.should_receive('ready').and_return(value).at_least.once cmds = ParallelCmds([cmd_mock]) assert_equal(cmds.ready(), value)