From 8e592c022938543a52d42838e95be9dd76611941 Mon Sep 17 00:00:00 2001 From: Lukas Puehringer Date: Wed, 20 Sep 2017 11:53:44 -0400 Subject: [PATCH] Add expected_command shlex parsing unit test The previous commit modified the layout template using in-toto tooling. As consequence a test scenario, i.e. parsing a command String into a list, disappeared. The newly added unit test restores the testing coverage. --- test/models/test_layout.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/models/test_layout.py b/test/models/test_layout.py index c64d1375b..56d9abbc1 100755 --- a/test/models/test_layout.py +++ b/test/models/test_layout.py @@ -188,5 +188,12 @@ def test_import_step_metadata_wrong_type(self): # Clean up os.remove(link_path) + def test_step_expected_command_shlex(self): + """Check that a step's `expected_command` passed as string is converted + to a list (using `shlex`). """ + step = Step(**{"expected_command": "rm -rf /"}) + self.assertTrue(isinstance(step.expected_command, list)) + self.assertTrue(len(step.expected_command) == 3) + if __name__ == "__main__": unittest.main()