tests: Modify unit tests as per changes to reverse schema and attack report generation

This commit is contained in:
Shreya Malviya 2021-10-12 15:54:41 +05:30
parent 7bdbdb1bfb
commit 1adf462ac3
3 changed files with 22 additions and 4 deletions

View File

@ -12,6 +12,7 @@ FAKE_CONFIG_SCHEMA_PER_ATTACK_TECHNIQUE = {
"T0000": {
"Definition Type 1": ["Config Option 1", "Config Option 2"],
"Definition Type 2": ["Config Option 5", "Config Option 6"],
"Property Type 1": ["Config Option 1 (Tab 1)"],
},
"T0001": {
"Definition Type 1": ["Config Option 1"],
@ -23,7 +24,7 @@ FAKE_CONFIG_SCHEMA_PER_ATTACK_TECHNIQUE = {
@pytest.fixture(scope="function", autouse=True)
def mock_config_schema_per_attack_technique(monkeypatch, fake_schema):
monkeypatch.setattr(
("monkey_island.cc.services.attack.technique_reports." "__init__.SCHEMA"),
("monkey_island.cc.services.attack.technique_reports.__init__.SCHEMA"),
fake_schema,
)
@ -42,7 +43,7 @@ class FakeAttackTechnique_TwoRelevantSystems(AttackTechnique):
class ExpectedMsgs_TwoRelevantSystems(Enum):
UNSCANNED: str = (
"UNSCANNED due to one of the following reasons:\n"
"- The following configuration options were disabled:<br/>"
"- The following configuration options were disabled or empty:<br/>"
"- Definition Type 1 — Config Option 1<br/>"
"- Definition Type 2 — Config Option 5<br/>"
)
@ -65,7 +66,7 @@ class ExpectedMsgs_OneRelevantSystem(Enum):
UNSCANNED: str = (
"UNSCANNED due to one of the following reasons:\n"
"- Monkey did not run on any System 1 systems.\n"
"- The following configuration options were disabled:<br/>"
"- The following configuration options were disabled or empty:<br/>"
"- Definition Type 1 — Config Option 1<br/>"
"- Definition Type 2 — Config Option 5<br/>"
)

View File

@ -6,6 +6,7 @@ REVERSE_FAKE_SCHEMA = {
"T0000": {
"Definition Type 1": ["Config Option 1", "Config Option 2"],
"Definition Type 2": ["Config Option 5", "Config Option 6"],
"Property Type 1": ["Config Option 1 (Tab 1)"],
},
"T0001": {
"Definition Type 1": ["Config Option 1"],

View File

@ -66,5 +66,21 @@ def fake_schema():
},
],
},
},
"properties": {
"property_type_1": {
"title": "Property Type 1",
"properties": {
"tab_1": {
"title": "Tab 1",
"properties": {
"config_option_1": {
"title": "Config Option 1",
"related_attack_techniques": ["T0000"],
},
},
}
},
}
},
}