Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron1535 committed Mar 2, 2025
1 parent b84b7ec commit 4ad2134
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -563,10 +563,12 @@ def cybelangel_report_comments_get_command(client: Client, args: dict) -> Comman
report_id = args.get("report_id", "")

response = client.get_report_comment(report_id)

if not response.get("comments"): # type: ignore
return CommandResults(readable_output=f"There are no comments for report ID: {report_id}.")

if isinstance(response, dict):
response["id"] = report_id
response["Comments"] = response.pop("comments")
hr_response = [
{**comment, "author_firstname": comment["author"]["firstname"], "author_lastname": comment["author"]["lastname"]}
for comment in response.get("comments", []) # type: ignore
Expand All @@ -587,7 +589,7 @@ def cybelangel_report_comments_get_command(client: Client, args: dict) -> Comman
removeNull=True,
)
return CommandResults(
outputs_prefix="CybelAngel.Report.Comments",
outputs_prefix="CybelAngel.Report",
outputs_key_field="id",
outputs=response,
readable_output=human_readable,
Expand Down Expand Up @@ -689,7 +691,7 @@ def cybelangel_report_remediation_request_create_command(client: Client, args: d
response = client.post_report_remediation_request(data)

return CommandResults(
outputs_prefix="CybelAngel.Report.RemediationRequest",
outputs_prefix="CybelAngel.RemediationRequest",
outputs_key_field="report_id",
outputs=response,
readable_output=f"Remediation request was created for {report_id}."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -759,8 +759,8 @@ def test_cybelangel_report_comments_get_command(mocker):
report_id = "11223344"
args = {'report_id': report_id}
response = cybelangel_report_comments_get_command(client, args)
assert response.outputs.get("comments")[0].get("discussion_id").startswith(report_id) # type: ignore
assert response.outputs.get("comments")[0].get("discussion_id").endswith("Tenant id") # type: ignore
assert response.outputs.get("Comments")[0].get("discussion_id").startswith(report_id) # type: ignore
assert response.outputs.get("Comments")[0].get("discussion_id").endswith("Tenant id") # type: ignore


def test_cybelangel_report_attachment_get_command(mocker):
Expand Down
52 changes: 27 additions & 25 deletions Packs/CybelAngel/TestPlaybooks/CybelAngel_Test_Playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ tasks:
- - operator: isNotEmpty
left:
value:
simple: CybelAngel.Report.reports.[0].id
simple: CybelAngel.Report.[0].id
iscontext: true
continueonerrortype: ""
view: |-
Expand Down Expand Up @@ -163,7 +163,7 @@ tasks:
- "6"
scriptarguments:
report_id:
simple: ${CybelAngel.Report.reports.[0].id}
simple: ${CybelAngel.Report.[0].id}
separatecontext: false
continueonerrortype: ""
view: |-
Expand Down Expand Up @@ -201,12 +201,14 @@ tasks:
- - operator: isNotEmpty
left:
value:
simple: ${CybelAngel.Report.reports.[0]}
simple: ${CybelAngel.Report.[0]}
iscontext: true
right:
value: {}
- - operator: isNotEmpty
left:
value:
simple: ${CybelAngel.Report.reports.[1]}
simple: ${CybelAngel.Report.[1]}
iscontext: true
continueonerrortype: ""
view: |-
Expand Down Expand Up @@ -243,7 +245,9 @@ tasks:
pdf:
simple: "True"
report_id:
simple: ${CybelAngel.Report.reports.[0].id}
simple: ${CybelAngel.Report.[0].id}
retry-count:
simple: "1"
separatecontext: false
continueonerrortype: ""
view: |-
Expand Down Expand Up @@ -315,13 +319,11 @@ tasks:
iscommand: true
brand: ""
nexttasks:
'#error#':
- "15"
'#none#':
- "10"
scriptarguments:
report_id:
simple: ${CybelAngel.Report.[0].reports.[0].id}
simple: ${CybelAngel.Report.[0].id}
separatecontext: false
continueonerror: true
continueonerrortype: errorPath
Expand Down Expand Up @@ -351,6 +353,8 @@ tasks:
iscommand: false
brand: ""
nexttasks:
'#default#':
- "15"
"yes":
- "11"
separatecontext: false
Expand Down Expand Up @@ -397,7 +401,7 @@ tasks:
csv:
simple: "True"
report_id:
simple: ${CybelAngel.Report.[0].reports.[0].id}
simple: ${CybelAngel.Report.[0].id}
separatecontext: false
continueonerrortype: ""
view: |-
Expand Down Expand Up @@ -473,7 +477,7 @@ tasks:
- "14"
scriptarguments:
report_id:
simple: ${CybelAngel.Report.[0].reports.[0].id}
simple: ${CybelAngel.Report.[0].id}
separatecontext: false
continueonerrortype: ""
view: |-
Expand Down Expand Up @@ -549,7 +553,7 @@ tasks:
- "16"
scriptarguments:
report_ids:
simple: ${CybelAngel.Report.reports.[0].id}
simple: ${CybelAngel.Report.[0].id}
status:
simple: resolved
separatecontext: false
Expand Down Expand Up @@ -586,7 +590,7 @@ tasks:
- "17"
scriptarguments:
report_id:
simple: ${CybelAngel.Report.reports.[0].id}
simple: ${CybelAngel.Report.[0].id}
separatecontext: false
continueonerrortype: ""
view: |-
Expand Down Expand Up @@ -662,7 +666,7 @@ tasks:
- "20"
scriptarguments:
report_id:
simple: ${CybelAngel.Report.[0].reports.[0].id}
simple: ${CybelAngel.Report.[0].id}
separatecontext: false
continueonerrortype: ""
view: |-
Expand Down Expand Up @@ -700,8 +704,10 @@ tasks:
- - operator: isNotEmpty
left:
value:
simple: ${CybelAngel.Report.[2].Comments.comments.[0].id}
simple: ${CybelAngel.Report.[0].Comments.[0].id}
iscontext: true
right:
value: {}
continueonerrortype: ""
view: |-
{
Expand Down Expand Up @@ -737,7 +743,7 @@ tasks:
content:
simple: Test Playbook
report_id:
simple: ${CybelAngel.Report.reports.[0].id}
simple: ${CybelAngel.Report.[0].id}
separatecontext: false
continueonerrortype: ""
view: |-
Expand Down Expand Up @@ -772,14 +778,11 @@ tasks:
conditions:
- label: "yes"
condition:
- - operator: isEqualString
- - operator: isNotEmpty
left:
value:
simple: CybelAngel.Report.[3].Comments.content
simple: CybelAngel.Report.[0].new
iscontext: true
right:
value:
simple: Test Playbook
continueonerrortype: ""
view: |-
{
Expand Down Expand Up @@ -815,9 +818,9 @@ tasks:
- "25"
scriptarguments:
attachment_id:
simple: ${CybelAngel.Report.[0].reports.[0].attachments.[0].id}
simple: ${CybelAngel.Report.[0].attachments.[0].id}
report_id:
simple: ${CybelAngel.Report.[0].reports.[0].id}
simple: ${CybelAngel.Report.[0].id}
separatecontext: false
continueonerror: true
continueonerrortype: errorPath
Expand Down Expand Up @@ -894,7 +897,7 @@ tasks:
- "27"
scriptarguments:
report_id:
simple: ${CybelAngel.Report.[0].reports.[0].id}
simple: ${CybelAngel.Report.[0].id}
requestor_email:
simple: [email protected]
requestor_fullname:
Expand Down Expand Up @@ -936,7 +939,7 @@ tasks:
- - operator: isNotEmpty
left:
value:
simple: CybelAngel.Report.[4].RemediationRequest.report_id
simple: CybelAngel.RemediationRequest.report_id
iscontext: true
right:
value: {}
Expand Down Expand Up @@ -966,7 +969,6 @@ tasks:
type: title
iscommand: false
brand: ""
description: ''
separatecontext: false
continueonerrortype: ""
view: |-
Expand Down

0 comments on commit 4ad2134

Please sign in to comment.