Skip to content

Commit

Permalink
Add expected_command shlex parsing unit test
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lukpueh committed Sep 20, 2017
1 parent f37a9c2 commit 8e592c0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/models/test_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 8e592c0

Please sign in to comment.