@@ -22,7 +22,7 @@ def test_finding_required_typerror(finding_local):
2222 '01234567-1234-abcd-0987-01234567890a'
2323 ),
2424 ):
25- resp = f .check_required_params (finding_local )
25+ f .check_required_params (finding_local )
2626
2727
2828def test_finding_generate_finding_keyerror (finding_local , finding_aws ):
@@ -33,11 +33,20 @@ def test_finding_generate_finding_keyerror(finding_local, finding_aws):
3333 """
3434 f = Finding ('' , '' )
3535 with pytest .raises (KeyError ):
36- resp = f .generate (finding_local )
36+ f .generate (finding_local )
3737
3838 del finding_aws ['plugin.type' ]
3939 with pytest .raises (KeyError , match = 'plugin.type' ):
40- resp = f .generate (finding_aws )
40+ f .generate (finding_aws )
41+
42+
43+ def test_finding_account_restrictions (finding_aws ):
44+ f = Finding ('' , '600832220000' , True )
45+ f .generate (finding_aws )
46+
47+ f = Finding ('' , 'ACCOUNT-ID' , True )
48+ with pytest .raises (KeyError , match = 's not within one of the allowed accounts' ):
49+ f .generate (finding_aws )
4150
4251
4352def test_finding_generate_finding_success (finding_aws ):
@@ -56,7 +65,7 @@ def test_finding_generate_finding_success(finding_aws):
5665 assert resp ['LastObservedAt' ] == '2018-12-14T12:07:38.155Z'
5766 assert (
5867 resp ['ProductArn' ]
59- == 'arn:aws:securityhub:AWS-REGION-1::product/tenable/tenable-io '
68+ == 'arn:aws:securityhub:AWS-REGION-1::product/tenable/vulnerability-management '
6069 )
6170 assert resp ['AwsAccountId' ] == 'ACCOUNT-ID'
6271 assert resp ['GeneratorId' ] == 'tenable-plugin-106875'
@@ -82,7 +91,7 @@ def test_finding_generate_finding_success(finding_aws):
8291 assert resp ['Resources' ][0 ]['Details' ]['AwsEc2Instance' ]['IpV4Addresses' ] == [
8392 '192.168.101.249'
8493 ]
85- assert resp ['Resources' ][0 ]['Details' ]['AwsEc2Instance' ][ 'IpV6Addresses' ] == [ ]
94+ assert 'IpV6Addresses' not in resp ['Resources' ][0 ]['Details' ]['AwsEc2Instance' ]
8695 assert resp ['ProductFields' ]['CVE' ] == ''
8796 assert resp ['ProductFields' ]['Plugin Family' ] == 'Debian Local Security Checks'
8897 assert resp ['ProductFields' ]['Type' ] == 'local'
0 commit comments