mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 14:55:00 +00:00
test(aws-provider): First tests (#1231)
* test(pre-commit): Include security checks * test(pre-commit): Include dependencies * test(aws-provider): First unit tests * test(arn-parsing): Include first tests * chore(providers): Remove old comments
This commit is contained in:
0
lib/arn/__init__.py
Normal file
0
lib/arn/__init__.py
Normal file
33
lib/arn/arn_test.py
Normal file
33
lib/arn/arn_test.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import sure # noqa
|
||||
|
||||
from lib.arn.arn import arn_parsing
|
||||
|
||||
ACCOUNT_ID = "123456789012"
|
||||
RESOURCE_TYPE = "role"
|
||||
IAM_ROLE = "test-role"
|
||||
|
||||
|
||||
class Test_ARN_Parsing:
|
||||
def test_arn_parsing(self):
|
||||
test_cases = [
|
||||
{
|
||||
"input_arn": f"arn:aws:iam::{ACCOUNT_ID}:{RESOURCE_TYPE}/{IAM_ROLE}",
|
||||
"expected": {
|
||||
"partition": "aws",
|
||||
"service": "iam",
|
||||
"region": None,
|
||||
"account_id": ACCOUNT_ID,
|
||||
"resource_type": RESOURCE_TYPE,
|
||||
"resource": IAM_ROLE,
|
||||
},
|
||||
}
|
||||
]
|
||||
for test in test_cases:
|
||||
input_arn = test["input_arn"]
|
||||
parsed_arn = arn_parsing(input_arn)
|
||||
parsed_arn.partition.should.equal(test["expected"]["partition"])
|
||||
parsed_arn.service.should.equal(test["expected"]["service"])
|
||||
parsed_arn.region.should.equal(test["expected"]["region"])
|
||||
parsed_arn.account_id.should.equal(test["expected"]["account_id"])
|
||||
parsed_arn.resource_type.should.equal(test["expected"]["resource_type"])
|
||||
parsed_arn.resource.should.equal(test["expected"]["resource"])
|
||||
Reference in New Issue
Block a user