Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix: When opening subreports it throws index error #3775

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion rocky/reports/views/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def save_report_data(
]

child_input_data = {
"input_data": {"input_oois": [ooi], "report_types": [report_type_id], "plugins": [child_plugins]}
"input_data": {"input_oois": [ooi], "report_types": [report_type_id], "plugins": child_plugins}
}

raw_id = bytes_client.upload_raw(
Expand Down
14 changes: 5 additions & 9 deletions rocky/tests/integration/test_report_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_run_report_task(octopoes_api_connector: OctopoesAPIConnector, report_ru
"input_data": {
"input_oois": ["Hostname|test|example.com", "Hostname|test|a.example.com"],
"report_types": ["dns-report"],
"plugins": {"required": {"dns-sec", "dns-records"}, "optional": ["dns-zone"]},
"plugins": {"required": {"dns-sec", "dns-records"}, "optional": {"dns-zone"}},
}
}

Expand All @@ -56,7 +56,7 @@ def test_run_report_task(octopoes_api_connector: OctopoesAPIConnector, report_ru
"input_data": {
"input_oois": ["Hostname|test|example.com"],
"report_types": ["dns-report"],
"plugins": [{"required": {"dns-sec", "dns-records"}, "optional": ["dns-zone"]}],
"plugins": {"required": {"dns-sec", "dns-records"}, "optional": {"dns-zone"}},
},
},
{
Expand All @@ -69,19 +69,15 @@ def test_run_report_task(octopoes_api_connector: OctopoesAPIConnector, report_ru
"input_data": {
"input_oois": ["Hostname|test|a.example.com"],
"report_types": ["dns-report"],
"plugins": [{"required": {"dns-sec", "dns-records"}, "optional": ["dns-zone"]}],
"plugins": {"required": {"dns-sec", "dns-records"}, "optional": {"dns-zone"}},
},
},
]

data_1 = json.loads(report_runner.bytes_client.upload_raw.mock_calls[1].kwargs["raw"])
data_1["input_data"]["plugins"][0]["required"] = set(
data_1["input_data"]["plugins"][0]["required"]
) # ordering issues
data_1["input_data"]["plugins"]["required"] = set(data_1["input_data"]["plugins"]["required"]) # ordering issues
data_2 = json.loads(report_runner.bytes_client.upload_raw.mock_calls[2].kwargs["raw"])
data_2["input_data"]["plugins"][0]["required"] = set(
data_2["input_data"]["plugins"][0]["required"]
) # ordering issues
data_2["input_data"]["plugins"]["required"] = set(data_2["input_data"]["plugins"]["required"]) # ordering issues

assert data_1 in both_calls
assert data_2 in both_calls
Expand Down
Loading