Skip to content

Commit

Permalink
fixes #169 post_processor/Manifest: add custom_data attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
mayn committed Mar 13, 2019
1 parent 0a9de63 commit 8503a8a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/packerlicious/post_processor.py
Expand Up @@ -320,6 +320,7 @@ class Manifest(PackerPostProcessor):

props = {
'output': (str, False),
'custom_data': (dict, False),
'strip_path': (validator.boolean, False),
}

Expand Down
29 changes: 29 additions & 0 deletions tests/packerlicious/test_post_processor_manifest.py
@@ -1,4 +1,6 @@
import packerlicious.post_processor as post_processor
from packerlicious.template import Template
import json


class TestManifestPostProcessor(object):
Expand All @@ -7,3 +9,30 @@ def test_no_required_fields(self):
b = post_processor.Manifest()

b.to_dict()

def test_custom_data(self):
expected_json = """
{
"post-processors": [
{
"type": "manifest",
"output": "manifest.json",
"strip_path": "true",
"custom_data": {
"my_custom_data": "example"
}
}
]
}
"""
p = post_processor.Manifest(
output="manifest.json",
strip_path=True,
custom_data={'my_custom_data': 'example'}
)
t = Template()
t.add_post_processor(p)

to_json = t.to_json()
assert to_json == json.dumps(json.loads(expected_json), sort_keys=True, indent=2,
separators=(',', ': '))

0 comments on commit 8503a8a

Please sign in to comment.