|
2 | 2 | Tests for custom STIX 2.0 attack objects in the mitreattack.stix20 module. |
3 | 3 |
|
4 | 4 | This module verifies the correct behavior and properties of custom ATT&CK objects |
5 | | -such as DataComponent, DataSource, Matrix, Tactic, Asset, and the StixObjectFactory. |
| 5 | +including DataComponent, DataSource, Matrix, Tactic, Asset, Analytic, |
| 6 | +DetectionStrategy, and the StixObjectFactory. |
6 | 7 | """ |
7 | 8 |
|
8 | 9 | import pytest |
9 | 10 | import stix2 |
10 | 11 | import stix2.exceptions |
11 | 12 |
|
12 | | -from mitreattack.stix20.custom_attack_objects import Asset, DataComponent, DataSource, Matrix, StixObjectFactory, Tactic |
| 13 | +from mitreattack.stix20.custom_attack_objects import ( |
| 14 | + Analytic, |
| 15 | + Asset, |
| 16 | + DataComponent, |
| 17 | + DataSource, |
| 18 | + DetectionStrategy, |
| 19 | + Matrix, |
| 20 | + StixObjectFactory, |
| 21 | + Tactic, |
| 22 | +) |
13 | 23 |
|
14 | 24 |
|
15 | 25 | class TestCustomAttackObjects: |
16 | 26 | """ |
17 | 27 | Test suite for custom ATT&CK STIX 2.0 objects and their factory. |
18 | 28 |
|
19 | | - This class contains tests for the creation and properties of custom ATT&CK objects, |
20 | | - including DataComponent, DataSource, Matrix, Tactic, Asset, and the StixObjectFactory. |
| 29 | + This class contains tests for the creation and properties of custom ATT&CK objects |
| 30 | + including DataComponent, DataSource, Matrix, Tactic, Asset, Analytic, |
| 31 | + DetectionStrategy, and the StixObjectFactory. |
21 | 32 | """ |
22 | 33 |
|
23 | 34 | def test_data_component(self): |
@@ -52,6 +63,8 @@ def test_stix_object_factory(self): |
52 | 63 | "x-mitre-matrix": Matrix, |
53 | 64 | "x-mitre-tactic": Tactic, |
54 | 65 | "x-mitre-asset": Asset, |
| 66 | + "x-mitre-analytic": Analytic, |
| 67 | + "x-mitre-detection-strategy": DetectionStrategy, |
55 | 68 | } |
56 | 69 |
|
57 | 70 | object_name = "Object name" |
@@ -88,3 +101,19 @@ def test_asset(self): |
88 | 101 |
|
89 | 102 | assert asset.name == name |
90 | 103 | assert asset.type == "x-mitre-asset" |
| 104 | + |
| 105 | + def test_analytic(self): |
| 106 | + """Test Analytic creation and properties.""" |
| 107 | + name = "Analytic" |
| 108 | + analytic = Analytic(name=name) |
| 109 | + |
| 110 | + assert analytic.name == name |
| 111 | + assert analytic.type == "x-mitre-analytic" |
| 112 | + |
| 113 | + def test_detection_strategy(self): |
| 114 | + """Test Detection Strategy creation and properties.""" |
| 115 | + name = "Detection Strategy" |
| 116 | + detection_strategy = DetectionStrategy(name=name) |
| 117 | + |
| 118 | + assert detection_strategy.name == name |
| 119 | + assert detection_strategy.type == "x-mitre-detection-strategy" |
0 commit comments