diff --git a/tests/providers/terraform_plan/direct_references/fixtures/at_least_one_aws_s3_bucket_int_config_refers_to_s3_bucket.tirith.json b/tests/providers/terraform_plan/fixtures/at_least_one_aws_s3_bucket_int_config_refers_to_s3_bucket.tirith.json similarity index 100% rename from tests/providers/terraform_plan/direct_references/fixtures/at_least_one_aws_s3_bucket_int_config_refers_to_s3_bucket.tirith.json rename to tests/providers/terraform_plan/fixtures/at_least_one_aws_s3_bucket_int_config_refers_to_s3_bucket.tirith.json diff --git a/tests/providers/terraform_plan/direct_references/fixtures/elb_references_to_secroup.tirith.json b/tests/providers/terraform_plan/fixtures/elb_references_to_secroup.tirith.json similarity index 100% rename from tests/providers/terraform_plan/direct_references/fixtures/elb_references_to_secroup.tirith.json rename to tests/providers/terraform_plan/fixtures/elb_references_to_secroup.tirith.json diff --git a/tests/providers/terraform_plan/direct_references/fixtures/elb_with_secgroup.tf b/tests/providers/terraform_plan/fixtures/elb_with_secgroup.tf similarity index 100% rename from tests/providers/terraform_plan/direct_references/fixtures/elb_with_secgroup.tf rename to tests/providers/terraform_plan/fixtures/elb_with_secgroup.tf diff --git a/tests/providers/terraform_plan/direct_references/fixtures/extra_elb_no_secgroup.tf b/tests/providers/terraform_plan/fixtures/extra_elb_no_secgroup.tf similarity index 100% rename from tests/providers/terraform_plan/direct_references/fixtures/extra_elb_no_secgroup.tf rename to tests/providers/terraform_plan/fixtures/extra_elb_no_secgroup.tf diff --git a/tests/providers/terraform_plan/direct_references/fixtures/fail_s3_referenced_by_to.tirith.json b/tests/providers/terraform_plan/fixtures/fail_s3_referenced_by_to.tirith.json similarity index 100% rename from tests/providers/terraform_plan/direct_references/fixtures/fail_s3_referenced_by_to.tirith.json rename to tests/providers/terraform_plan/fixtures/fail_s3_referenced_by_to.tirith.json diff --git a/tests/providers/terraform_plan/input.json b/tests/providers/terraform_plan/fixtures/input.json similarity index 100% rename from tests/providers/terraform_plan/input.json rename to tests/providers/terraform_plan/fixtures/input.json diff --git a/tests/providers/terraform_plan/input_aws_instance.json b/tests/providers/terraform_plan/fixtures/input_aws_instance.json similarity index 100% rename from tests/providers/terraform_plan/input_aws_instance.json rename to tests/providers/terraform_plan/fixtures/input_aws_instance.json diff --git a/tests/providers/terraform_plan/input_implicit_elb_secgroup.json b/tests/providers/terraform_plan/fixtures/input_implicit_elb_secgroup.json similarity index 100% rename from tests/providers/terraform_plan/input_implicit_elb_secgroup.json rename to tests/providers/terraform_plan/fixtures/input_implicit_elb_secgroup.json diff --git a/tests/providers/terraform_plan/input_instance_deps_s3.json b/tests/providers/terraform_plan/fixtures/input_instance_deps_s3.json similarity index 100% rename from tests/providers/terraform_plan/input_instance_deps_s3.json rename to tests/providers/terraform_plan/fixtures/input_instance_deps_s3.json diff --git a/tests/providers/terraform_plan/input_s3_destroy.json b/tests/providers/terraform_plan/fixtures/input_s3_destroy.json similarity index 100% rename from tests/providers/terraform_plan/input_s3_destroy.json rename to tests/providers/terraform_plan/fixtures/input_s3_destroy.json diff --git a/tests/providers/terraform_plan/input_vnet_destroy.json b/tests/providers/terraform_plan/fixtures/input_vnet_destroy.json similarity index 100% rename from tests/providers/terraform_plan/input_vnet_destroy.json rename to tests/providers/terraform_plan/fixtures/input_vnet_destroy.json diff --git a/tests/providers/terraform_plan/input_vnet_destroy_new.json b/tests/providers/terraform_plan/fixtures/input_vnet_destroy_new.json similarity index 100% rename from tests/providers/terraform_plan/input_vnet_destroy_new.json rename to tests/providers/terraform_plan/fixtures/input_vnet_destroy_new.json diff --git a/tests/providers/terraform_plan/policy.json b/tests/providers/terraform_plan/fixtures/policy.json similarity index 100% rename from tests/providers/terraform_plan/policy.json rename to tests/providers/terraform_plan/fixtures/policy.json diff --git a/tests/providers/terraform_plan/policy_aws_instance.json b/tests/providers/terraform_plan/fixtures/policy_aws_instance.json similarity index 100% rename from tests/providers/terraform_plan/policy_aws_instance.json rename to tests/providers/terraform_plan/fixtures/policy_aws_instance.json diff --git a/tests/providers/terraform_plan/policy_ec2_depends_on_s3.json b/tests/providers/terraform_plan/fixtures/policy_ec2_depends_on_s3.json similarity index 100% rename from tests/providers/terraform_plan/policy_ec2_depends_on_s3.json rename to tests/providers/terraform_plan/fixtures/policy_ec2_depends_on_s3.json diff --git a/tests/providers/terraform_plan/policy_elb_secgroup_reference.json b/tests/providers/terraform_plan/fixtures/policy_elb_secgroup_reference.json similarity index 100% rename from tests/providers/terraform_plan/policy_elb_secgroup_reference.json rename to tests/providers/terraform_plan/fixtures/policy_elb_secgroup_reference.json diff --git a/tests/providers/terraform_plan/policy_s3_destroy.json b/tests/providers/terraform_plan/fixtures/policy_s3_destroy.json similarity index 100% rename from tests/providers/terraform_plan/policy_s3_destroy.json rename to tests/providers/terraform_plan/fixtures/policy_s3_destroy.json diff --git a/tests/providers/terraform_plan/policy_vnet_destroy.json b/tests/providers/terraform_plan/fixtures/policy_vnet_destroy.json similarity index 100% rename from tests/providers/terraform_plan/policy_vnet_destroy.json rename to tests/providers/terraform_plan/fixtures/policy_vnet_destroy.json diff --git a/tests/providers/terraform_plan/policy_vnet_destroy_new.json b/tests/providers/terraform_plan/fixtures/policy_vnet_destroy_new.json similarity index 100% rename from tests/providers/terraform_plan/policy_vnet_destroy_new.json rename to tests/providers/terraform_plan/fixtures/policy_vnet_destroy_new.json diff --git a/tests/providers/terraform_plan/direct_references/fixtures/s3_bucket_not_all_has_intelligent_tiering.tf b/tests/providers/terraform_plan/fixtures/s3_bucket_not_all_has_intelligent_tiering.tf similarity index 100% rename from tests/providers/terraform_plan/direct_references/fixtures/s3_bucket_not_all_has_intelligent_tiering.tf rename to tests/providers/terraform_plan/fixtures/s3_bucket_not_all_has_intelligent_tiering.tf diff --git a/tests/providers/terraform_plan/direct_references/fixtures/s3_bucket_with_intelligent_tiering_config.tf b/tests/providers/terraform_plan/fixtures/s3_bucket_with_intelligent_tiering_config.tf similarity index 100% rename from tests/providers/terraform_plan/direct_references/fixtures/s3_bucket_with_intelligent_tiering_config.tf rename to tests/providers/terraform_plan/fixtures/s3_bucket_with_intelligent_tiering_config.tf diff --git a/tests/providers/terraform_plan/direct_references/fixtures/s3_referenced_by_intelligent_tiering_config.tirith.json b/tests/providers/terraform_plan/fixtures/s3_referenced_by_intelligent_tiering_config.tirith.json similarity index 100% rename from tests/providers/terraform_plan/direct_references/fixtures/s3_referenced_by_intelligent_tiering_config.tirith.json rename to tests/providers/terraform_plan/fixtures/s3_referenced_by_intelligent_tiering_config.tirith.json diff --git a/tests/providers/terraform_plan/direct_references/fixtures/s3_referenced_by_intelligent_tiering_config_err_tolerance_1.tirith.json b/tests/providers/terraform_plan/fixtures/s3_referenced_by_intelligent_tiering_config_err_tolerance_1.tirith.json similarity index 100% rename from tests/providers/terraform_plan/direct_references/fixtures/s3_referenced_by_intelligent_tiering_config_err_tolerance_1.tirith.json rename to tests/providers/terraform_plan/fixtures/s3_referenced_by_intelligent_tiering_config_err_tolerance_1.tirith.json diff --git a/tests/providers/terraform_plan/direct_references/test_direct_references.py b/tests/providers/terraform_plan/test_direct_references.py similarity index 100% rename from tests/providers/terraform_plan/direct_references/test_direct_references.py rename to tests/providers/terraform_plan/test_direct_references.py diff --git a/tests/providers/terraform_plan/test_terraform_plan.py b/tests/providers/terraform_plan/test_terraform_plan.py index 48894443..a28d9776 100644 --- a/tests/providers/terraform_plan/test_terraform_plan.py +++ b/tests/providers/terraform_plan/test_terraform_plan.py @@ -1,13 +1,7 @@ -import json -import os import pytest from tirith.providers.terraform_plan import handler - - -def load_terraform_plan_json(json_path): - with open(f"{os.path.dirname(os.path.abspath(__file__))}/{json_path}", "r") as fp: - return json.load(fp) +from utils import load_terraform_plan_json input_data = load_terraform_plan_json("input.json") diff --git a/tests/providers/terraform_plan/utils.py b/tests/providers/terraform_plan/utils.py new file mode 100644 index 00000000..ba617f7f --- /dev/null +++ b/tests/providers/terraform_plan/utils.py @@ -0,0 +1,7 @@ +import json +import os + + +def load_terraform_plan_json(json_path): + with open(f"{os.path.dirname(os.path.abspath(__file__))}/fixtures/{json_path}", "r") as fp: + return json.load(fp)