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

fix(github): changed the schema to accept no description for org #3589

Merged
merged 3 commits into from
Oct 2, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion checkov/github/schemas/org_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ def __init__(self) -> None:
"type": "string"
},
"description": {
"type": "string"
"oneOf": [
{"type": "string"},
{"type": "null"}
]
},
"ipAllowListEnabledSetting": {
"type": "string"
Expand Down
22 changes: 19 additions & 3 deletions tests/github/test_dal.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_org_security(mocker: MockerFixture):
"organization": {
"name": "Bridgecrew",
"login": "Bridgecrew-dev",
"description": "",
"description": None,
"ipAllowListEnabledSetting": "DISABLED",
"ipAllowListForInstalledAppsEnabledSetting": "DISABLED",
"requiresTwoFactorAuthentication": False,
Expand All @@ -23,8 +23,24 @@ def test_org_security(mocker: MockerFixture):
}
}
mocker.patch("checkov.common.vcs.base_vcs_dal.BaseVCSDAL._request_graphql", return_value=mock_data)
result = dal.get_organization_security()
assert result
result1 = dal.get_organization_security()

mock_data2 = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you create a separate test function for this case and name it accordingly, something like test_org_security with_empty_ description.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks :) changed it!

"data": {
"organization": {
"name": "Bridgecrew",
"login": "Bridgecrew-dev",
"description": "",
"ipAllowListEnabledSetting": "DISABLED",
"ipAllowListForInstalledAppsEnabledSetting": "DISABLED",
"requiresTwoFactorAuthentication": False,
"samlIdentityProvider": None
}
}
}
mocker.patch("checkov.common.vcs.base_vcs_dal.BaseVCSDAL._request_graphql", return_value=mock_data2)
result2 = dal.get_organization_security()
assert result1 and result2


def test_validate_github_conf_paths():
Expand Down