diff --git a/plugins/aws/test/collector_test.py b/plugins/aws/test/collector_test.py index 98d24cfc64..2c4f545cb9 100644 --- a/plugins/aws/test/collector_test.py +++ b/plugins/aws/test/collector_test.py @@ -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 @@ -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 diff --git a/plugins/aws/test/resources/files/guardduty/get-findings__foo_foo.json b/plugins/aws/test/resources/files/guardduty/get-findings__foo_foo.json index 1b4dc2bfd4..351ba4dd16 100644 --- a/plugins/aws/test/resources/files/guardduty/get-findings__foo_foo.json +++ b/plugins/aws/test/resources/files/guardduty/get-findings__foo_foo.json @@ -8,7 +8,7 @@ "Description": "foo", "Id": "foo", "Partition": "foo", - "Region": "foo", + "Region": "global", "Resource": { "AccessKeyDetails": { "AccessKeyId": "foo", @@ -83,7 +83,7 @@ }, "ImageDescription": "foo", "ImageId": "foo", - "InstanceId": "foo", + "InstanceId": "i-1", "InstanceState": "foo", "InstanceType": "foo", "OutpostArn": "foo", diff --git a/plugins/aws/test/resources/guardduty.py b/plugins/aws/test/resources/guardduty.py deleted file mode 100644 index 69a95b4db5..0000000000 --- a/plugins/aws/test/resources/guardduty.py +++ /dev/null @@ -1,7 +0,0 @@ -from fix_plugin_aws.resource.guardduty import AwsGuardDutyFinding -from test.resources import round_trip_for - - -def test_notebooks() -> None: - _, builder = round_trip_for(AwsGuardDutyFinding) - assert len(builder.resources_of(AwsGuardDutyFinding)) == 1 diff --git a/plugins/aws/test/resources/guardduty_test.py b/plugins/aws/test/resources/guardduty_test.py new file mode 100644 index 0000000000..707553b910 --- /dev/null +++ b/plugins/aws/test/resources/guardduty_test.py @@ -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