-
Notifications
You must be signed in to change notification settings - Fork 9
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
JSON content extension #130
Conversation
ed2eacf
to
12923d4
Compare
5b6b888
to
38a6cc4
Compare
504fe54
to
8cfcbe6
Compare
15ad63a
to
9018a6d
Compare
def test_json_count_of_rules(): | ||
report = get_report() | ||
json_dict = report.as_dict_for_default_json() | ||
assert len(json_dict["rules"]) == 714 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think that it's the best idea to have a test file that contains 714 rules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's okay. This test is labelled as an integration test. So it can be excluded from the normal test run using pytest -m "not integration_test"
to reduce testing time. I think this test should check more than just the number of rules, but if I get too specific, the test will break after changing the JSON schema.
if rule_id in ids_of_selected_rules: | ||
selected_rules[rule_id] = rule | ||
elif rule["result"] != "notselected" and not is_not_empty(ids_of_selected_rules): | ||
selected_rules[rule_id] = rule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both branches do the same, please consolidate
9018a6d
to
974fdea
Compare
Changes:
|
974fdea
to
6a0e9b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general, just some minor things to fix.
tests/json_schema_of_report.json
Outdated
"scan_result", | ||
"rules" | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No new line at the end.
def test_rearrange_identifiers(dictionary_json, result): | ||
rearrange_identifiers(dictionary_json) | ||
print(dictionary_json) | ||
print("aaaa") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove that.
@pytest.mark.parametrize( | ||
"dictionary, result", | ||
[ | ||
({"a": "", "b": {"c": ""}, "x": "x"}, {"x": "x"}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're testing the same "b": {"c": ""}
5 times. It does not bring any more security but drastically reduces test readability. Make sure that your cases are as unique as possible.
rearrange_identifiers(dictionary_json) | ||
print(dictionary_json) | ||
print("aaaa") | ||
print(result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this too, I guess.
6a0e9b6
to
a286865
Compare
This PR expands JSON content. It also adds:
It depends on #129