Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
1101-1 committed Oct 22, 2024
1 parent 8a5841e commit a342999
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
4 changes: 4 additions & 0 deletions plugins/aws/test/collector_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
called_collect_apis,
called_mutator_apis,
)
from fix_plugin_aws.resource.guardduty import AwsGuardDutyFinding
from fix_plugin_aws.resource.base import AwsResource, AwsApiSpec, GraphBuilder, AwsRegion
from fix_plugin_aws.resource.ec2 import AwsEc2Instance
from fixlib.baseresources import BaseResource
Expand All @@ -29,6 +30,9 @@ def count_kind(clazz: Type[AwsResource]) -> int:
return count

for resource in all_resources:
# we do not add findings to the graph --> skip check
if issubclass(resource, AwsGuardDutyFinding):
continue
assert count_kind(resource) > 0, f"No instances of {resource.__name__} found"

# make sure all threads have been joined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"Description": "foo",
"Id": "foo",
"Partition": "foo",
"Region": "foo",
"Region": "global",
"Resource": {
"AccessKeyDetails": {
"AccessKeyId": "foo",
Expand Down Expand Up @@ -83,7 +83,7 @@
},
"ImageDescription": "foo",
"ImageId": "foo",
"InstanceId": "foo",
"InstanceId": "i-1",
"InstanceState": "foo",
"InstanceType": "foo",
"OutpostArn": "foo",
Expand Down
7 changes: 0 additions & 7 deletions plugins/aws/test/resources/guardduty.py

This file was deleted.

8 changes: 8 additions & 0 deletions plugins/aws/test/resources/guardduty_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from fix_plugin_aws.resource.ec2 import AwsEc2Instance
from fix_plugin_aws.resource.guardduty import AwsGuardDutyFinding
from test.resources import round_trip_for


def test_guardduty_findings() -> None:
collected, _ = round_trip_for(AwsEc2Instance, region_name="global", collect_also=[AwsGuardDutyFinding])
assert len(collected._assessments) == 1

0 comments on commit a342999

Please sign in to comment.