|
@@ 120-134 (lines=15) @@
|
| 117 |
|
def test_set_running_command_as_failed(self): |
| 118 |
|
# SetUp |
| 119 |
|
command = self.command_manager.get_command_to_run() |
| 120 |
|
error_code = 1 |
| 121 |
|
|
| 122 |
|
# The function to test |
| 123 |
|
self.command_manager.set_running_command_as_finished(command, error_code) |
| 124 |
|
|
| 125 |
|
# Test validation |
| 126 |
|
with open(self.command_manager._commands_filename, "r") as commands_file: |
| 127 |
|
assert_equal(commands_file.read(), self.command2 + self.command3) |
| 128 |
|
|
| 129 |
|
with open(self.command_manager._running_commands_filename, "r") as running_commands_file: |
| 130 |
|
assert_equal(running_commands_file.read(), "") |
| 131 |
|
|
| 132 |
|
with open(self.command_manager._failed_commands_filename, "r") as failed_commands_file: |
| 133 |
|
assert_equal(failed_commands_file.read(), self.command1) |
| 134 |
|
|
| 135 |
|
assert_true(not os.path.isfile(self.command_manager._finished_commands_filename)) |
| 136 |
|
|
| 137 |
|
def test_reset_running_commands(self): |
|
@@ 63-76 (lines=14) @@
|
| 60 |
|
# Test validation |
| 61 |
|
assert_equal(len(failed_commands), 0) |
| 62 |
|
|
| 63 |
|
def test_get_command_to_run(self): |
| 64 |
|
# The function to test |
| 65 |
|
command = self.command_manager.get_command_to_run() |
| 66 |
|
|
| 67 |
|
# Test validation |
| 68 |
|
assert_equal(command, self.command1.strip()) |
| 69 |
|
|
| 70 |
|
with open(self.command_manager._commands_filename, "r") as commands_file: |
| 71 |
|
assert_equal(commands_file.read(), self.command2 + self.command3) |
| 72 |
|
|
| 73 |
|
with open(self.command_manager._running_commands_filename, "r") as running_commands_file: |
| 74 |
|
assert_equal(running_commands_file.read(), self.command1) |
| 75 |
|
|
| 76 |
|
assert_true(not os.path.isfile(self.command_manager._finished_commands_filename)) |
| 77 |
|
|
| 78 |
|
def test_get_nb_commands_to_run(self): |
| 79 |
|
assert_equal(self.command_manager.get_nb_commands_to_run(), self.nb_commands) |
|
@@ 29-42 (lines=14) @@
|
| 26 |
|
def tearDown(self): |
| 27 |
|
shutil.rmtree(self._base_dir) |
| 28 |
|
|
| 29 |
|
def test_set_commands_to_run(self): |
| 30 |
|
# SetUp |
| 31 |
|
commands = ["4", "5", "6"] |
| 32 |
|
|
| 33 |
|
# The function to test |
| 34 |
|
self.command_manager.set_commands_to_run(commands) |
| 35 |
|
|
| 36 |
|
# Test validation |
| 37 |
|
with open(self.command_manager._commands_filename, "r") as commands_file: |
| 38 |
|
assert_equal(commands_file.read(), self.command1 + self.command2 + self.command3 + "4\n5\n6\n") |
| 39 |
|
|
| 40 |
|
assert_true(not os.path.isfile(self.command_manager._running_commands_filename)) |
| 41 |
|
|
| 42 |
|
assert_true(not os.path.isfile(self.command_manager._finished_commands_filename)) |
| 43 |
|
|
| 44 |
|
def test_get_failed_commands(self): |
| 45 |
|
# Setup |