Skip to content

Commit

Permalink
Refactor formData payload generation (WorkflowDefinitionsImport). Rel…
Browse files Browse the repository at this point in the history
…ates to #1160.
  • Loading branch information
jshcodes committed May 18, 2024
1 parent c8454ef commit 4c5cbd6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/falconpy/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,11 @@ def import_definition(self: object, parameters: dict = None, **kwargs) -> Dict[s
try:
with open(data_file, "r", encoding="utf-8") as yaml_file:
file_data = yaml_file.read()
file_extended = {"name": "yaml_upload", "data_file": file_data, "type": content_type}
file_extended = [("data_file", ("yaml_upload", file_data, content_type))]
except FileNotFoundError:
data_file = None

# Remove the data file from the keywords dictionary before args_to_params
kwargs.pop("data_file")
if data_file and file_data:
returned = process_service_request(
calling_object=self,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def run_all_tests(self):
"WorkflowDefinitionsImport": falcon.import_definition(validate_only=True, data_file="this_will_415"),
"WorkflowDefinitionsImport2": falcon.import_definition(validate_only=True, file_data="this_will_500"),
"WorkflowDefinitionsImport3": falcon.import_definition(validate_only=True, data_file="not_here.yml"),
"WorkflowDefinitionsImport4": falcon.import_definition(validate_only=True, data_file="tests/test.yml"),
"WorkflowDefinitionsImport4": falcon.import_definition(validate_only=True, data_file="tests/test.yml", name="workflow_name"),
"WorkflowDefinitionsUpdate": falcon.update_definition(change_log="testing"),
"WorkflowGetHumanInputV1": falcon.get_human_input(ids="1234567"),
"WorkflowUpdateHumanInputV1": falcon.update_human_input(input="whatever", note="whatever"),
Expand Down

0 comments on commit 4c5cbd6

Please sign in to comment.