Skip to content

Commit

Permalink
add last 1% for test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
allisonrobbins committed Jun 28, 2024
1 parent 6cae3b4 commit 8571e32
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions tests/fixtures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,14 @@ def get_tree_bundle():
start_refs=[action1.id, action2.id],
created_by_ref=author.id,
)
condition = AttackCondition(
id="attack-condition--64d5bf0b-6acc-4f43-b0f2-aa93a219897a",
created=datetime(2022, 8, 25, 19, 26, 31),
modified=datetime(2022, 8, 25, 19, 26, 31),
description="My condition",
on_true_refs=[action1.id],
on_false_refs=[action2.id],
)
return stix2.Bundle(
flow,
author,
Expand All @@ -234,5 +242,6 @@ def get_tree_bundle():
asset,
infra,
infra_rel,
condition,
id="bundle--06cf9129-8d0d-4d58-9484-b5323caf09ad",
)
4 changes: 3 additions & 1 deletion tests/test_graphviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def test_convert_attack_flow_to_graphviz():

def test_convert_attack_tree_to_graphviz():
output = attack_flow.graphviz.convert_attack_tree(get_tree_bundle())

assert output == dedent(
"""\
digraph {
Expand All @@ -58,6 +57,9 @@ def test_convert_attack_tree_to_graphviz():
\t"attack-asset--4ae37379-6a11-44c1-b6a8-d11733cfac06" -> "infrastructure--79d21912-36b7-4af9-8958-38949dd0d6de" [label=object]
\t"infrastructure--a75c83f7-147e-4695-b173-0981521b2f01" [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="5"><TR><TD BGCOLOR="#cccccc" COLSPAN="2"><B>Infrastructure</B></TD></TR><TR><TD ALIGN="LEFT" BALIGN="LEFT"><B>Name</B></TD><TD ALIGN="LEFT" BALIGN="LEFT">Test Infra</TD></TR><TR><TD ALIGN="LEFT" BALIGN="LEFT"><B>Infrastructure Types</B></TD><TD ALIGN="LEFT" BALIGN="LEFT">workstation</TD></TR></TABLE>> shape=plaintext]
\t"attack-action--24fc6003-33f6-4dd7-a929-b6031927940f" -> "infrastructure--a75c83f7-147e-4695-b173-0981521b2f01" [label="related-to"]
\t"attack-condition--64d5bf0b-6acc-4f43-b0f2-aa93a219897a" [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="5"><TR><TD BGCOLOR="#99ff99" COLSPAN="2"><B>Condition</B></TD></TR><TR><TD ALIGN="LEFT" BALIGN="LEFT"><B>Description</B></TD><TD ALIGN="LEFT" BALIGN="LEFT">My condition</TD></TR></TABLE>> shape=plaintext]
\t"attack-condition--64d5bf0b-6acc-4f43-b0f2-aa93a219897a" -> "attack-action--d63857d5-1043-45a4-9397-40ef68db4c5f" [label=on_true]
\t"attack-condition--64d5bf0b-6acc-4f43-b0f2-aa93a219897a" -> "attack-action--24fc6003-33f6-4dd7-a929-b6031927940f" [label=on_false]
}
"""
)
Expand Down
4 changes: 4 additions & 0 deletions tests/test_mermaid.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,14 @@ class infrastructure__79d21912_36b7_4af9_8958_38949dd0d6de builtin
class attack_asset__4ae37379_6a11_44c1_b6a8_d11733cfac06 builtin
infrastructure__a75c83f7_147e_4695_b173_0981521b2f01["<b>Infrastructure</b> - <b>Name</b>:<br>Test Infra - <b>Infrastructure<br>Types</b>: workstation"]
class infrastructure__a75c83f7_147e_4695_b173_0981521b2f01 builtin
attack_condition__64d5bf0b_6acc_4f43_b0f2_aa93a219897a["<b>Condition:</b> My condition"]
class attack_condition__64d5bf0b_6acc_4f43_b0f2_aa93a219897a condition
attack_action__d63857d5_1043_45a4_9397_40ef68db4c5f -->| | attack_action__1994e9f2_11f1_489a_a5e7_3ad4cfd8890a
attack_action__1994e9f2_11f1_489a_a5e7_3ad4cfd8890a -->| | attack_action__a0847849_a533_4b1f_a94a_720bbd25fc17
attack_action__24fc6003_33f6_4dd7_a929_b6031927940f -->| | attack_action__1994e9f2_11f1_489a_a5e7_3ad4cfd8890a
attack_action__24fc6003_33f6_4dd7_a929_b6031927940f -->|related-to| infrastructure__a75c83f7_147e_4695_b173_0981521b2f01
attack_condition__64d5bf0b_6acc_4f43_b0f2_aa93a219897a -->|on_true| attack_action__d63857d5_1043_45a4_9397_40ef68db4c5f
attack_condition__64d5bf0b_6acc_4f43_b0f2_aa93a219897a -->|on_false| attack_action__24fc6003_33f6_4dd7_a929_b6031927940f
"""
)

0 comments on commit 8571e32

Please sign in to comment.