diff options
author | Stephen Fromm <sfromm@gmail.com> | 2012-06-11 23:09:54 -0700 |
---|---|---|
committer | Stephen Fromm <sfromm@gmail.com> | 2012-06-11 23:09:54 -0700 |
commit | 9cf182c225c8448a511977bc40e03ca811b43f59 (patch) | |
tree | 2c9641cb25eab3647b8b3f8f975a72ba495cb562 /test | |
parent | 93ac6c5ba09ed55a32555fe5ffd8f88584fc6d1a (diff) | |
download | ansible-9cf182c225c8448a511977bc40e03ca811b43f59.tar.gz |
Add assemble module
This adds a module that concatenates (ie. assembles) a file from
fragments in a directory in alphabetical order. It chains the file
module afterward to fix up ownership and permission. This also adds
tests for the assemble module with fragments in assemble.d.
Diffstat (limited to 'test')
-rw-r--r-- | test/TestRunner.py | 23 | ||||
-rw-r--r-- | test/assemble.d/00-source.txt | 2 | ||||
-rw-r--r-- | test/assemble.d/01-source.txt | 2 | ||||
-rw-r--r-- | test/assemble.d/02.source.txt | 4 |
4 files changed, 31 insertions, 0 deletions
diff --git a/test/TestRunner.py b/test/TestRunner.py index e97e9d6ce4..76c85f7af0 100644 --- a/test/TestRunner.py +++ b/test/TestRunner.py @@ -231,5 +231,28 @@ class TestRunner(unittest.TestCase): def test_service(self): # TODO: tests for the service module pass + def test_assemble(self): + input = self._get_test_file('assemble.d') + metadata = self._get_test_file('metadata.json') + output = self._get_stage_file('sample.out') + result = self._run('assemble', [ + "src=%s" % input, + "dest=%s" % output, + "metadata=%s" % metadata + ]) + assert os.path.exists(output) + out = file(output).read() + assert out.find("first") != -1 + assert out.find("second") != -1 + assert out.find("third") != -1 + assert result['changed'] == True + assert 'md5sum' in result + assert 'failed' not in result + result = self._run('assemble', [ + "src=%s" % input, + "dest=%s" % output, + "metadata=%s" % metadata + ]) + assert result['changed'] == False diff --git a/test/assemble.d/00-source.txt b/test/assemble.d/00-source.txt new file mode 100644 index 0000000000..1b3985419f --- /dev/null +++ b/test/assemble.d/00-source.txt @@ -0,0 +1,2 @@ +# This is the first comment. +[somegroup] diff --git a/test/assemble.d/01-source.txt b/test/assemble.d/01-source.txt new file mode 100644 index 0000000000..fc88cb924e --- /dev/null +++ b/test/assemble.d/01-source.txt @@ -0,0 +1,2 @@ +# This is the second comment. +127.0.0.2 diff --git a/test/assemble.d/02.source.txt b/test/assemble.d/02.source.txt new file mode 100644 index 0000000000..a3f1d96b48 --- /dev/null +++ b/test/assemble.d/02.source.txt @@ -0,0 +1,4 @@ +# This is the third comment. +[somegroup:vars] +foo=bar +# 無 可 無 非 常 無 |