Created
November 23, 2022 11:10
-
-
Save olehermanse/b33da70f4133774554ec61a478567568 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cfbs.pretty import pretty | |
def mock_get_input(): | |
return [ | |
{ | |
"type": "list", | |
"variable": "files", | |
"namespace": "delete_files", | |
"bundle": "delete_files", | |
"label": "Files", | |
"subtype": [ | |
{ | |
"key": "path", | |
"type": "string", | |
"label": "Path", | |
"question": "Path to file", | |
}, | |
{ | |
"key": "why", | |
"type": "string", | |
"label": "Why", | |
"question": "Why should this file be deleted?", | |
"default": "Unknown", | |
}, | |
], | |
"while": "Specify another file you want deleted on your hosts?", | |
"response": [], | |
} | |
] | |
def mock_set_input(data): | |
print(pretty(data) + "\n") | |
input_data = mock_get_input() | |
for object in input_data: | |
if object["variable"] == "files": | |
object["response"] = [{"path": "/tmp/deleteme", "why": "It's temporary!"}] | |
else: | |
assert False, "Not expecting other variables in this module" | |
mock_set_input(input_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment