[CL4B] Inspector Basics Scenario in Python#7625
[CL4B] Inspector Basics Scenario in Python#7625tejasgn1 wants to merge 1 commit intoawsdocs:mainfrom
Conversation
| # snippet-start:[inspector.yaml] | ||
| # Inspector code examples for the AWS SDK for Python (Boto3). | ||
| inspector_Hello: | ||
| title: Hello &Inspector; |
There was a problem hiding this comment.
We may have to add something to get the entities correct. For example, Inspector is INS1long.
| title: Get &Inspector; account status | ||
| title_abbrev: Get account status | ||
| synopsis: get the status of &Inspector; for your account. | ||
| category: Basics |
There was a problem hiding this comment.
It's setting the category of all of these to Basics, I'm not sure that is necessary.
| excerpts: | ||
| - description: Run an interactive scenario demonstrating &Inspector; features. | ||
| snippet_tags: | ||
| - python.example_code.inspector.InspectorScenario |
There was a problem hiding this comment.
Usually we show the wrapper here as well.
| title: Learn the basics of &Inspector; | ||
| title_abbrev: Learn the basics | ||
| synopsis: learn the basics of &Inspector;. | ||
| category: Scenarios |
There was a problem hiding this comment.
This section should have a synopsis list.
| from test_tools.glacier_stubber import GlacierStubber | ||
| from test_tools.glue_stubber import GlueStubber | ||
| from test_tools.iam_stubber import IamStubber | ||
| from test_tools.inspector_stubber import InspectorStubber |
There was a problem hiding this comment.
It's missing the line that adds the stubber below, which is causing the stubbed tests to fail with this error: test_tools.stubber_factory.StubberFactoryNotImplemented: If you see this exception, it probably means that you forg...
| for finding in findings_list[ | ||
| :2 | ||
| ]: # Show first 2 findings per severity | ||
| title = finding.get("title", "No title") |
There was a problem hiding this comment.
I'm unable to verify if any of these print statements work without simulating a severity finding.
| "vulnerablePackages", [] | ||
| ) | ||
| if vulnerable_packages: | ||
| package = vulnerable_packages[0] |
There was a problem hiding this comment.
If we aren't able to verify this with a finding, we probably shouldn't include it.
|
|
||
|
|
||
| @pytest.mark.integ | ||
| def test_get_account_status_integration(): |
There was a problem hiding this comment.
We would prefer to have a single integration test that runs the entire scenario and verifies that it makes it to the end successfully. When I ran these tests, it left my account with Inspector enabled instead of returning it to the disabled state.
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "error_code", [None, "ValidationException", "AccessDeniedException"] |
There was a problem hiding this comment.
I was unable to run these tests without the stubber properly initialized.
| print(f"CWE IDs: {', '.join(cwes)}") | ||
|
|
||
| # Show EPSS score | ||
| epss_score = details.get("epssScore") |
There was a problem hiding this comment.
We may need more parameter validation. For example, this property is an array, but the code is referencing and displaying it like a string.
The changes in this PR were generated using CodeLoom-4-BedRock(CL4B) for Inspector service in Python language