Beispiel #1
0
 def test_failure_default(self):
     hcl_res = hcl2.loads("""
     resource "github_repository" "test" {
         description   = "test repo"
         name          = "test"
     }
     """)
     resource_conf = hcl_res['resource'][0]['github_repository']['test']
     scan_result = check.scan_resource_conf(conf=resource_conf)
     self.assertEqual(CheckResult.FAILED, scan_result)
Beispiel #2
0
 def test_success_private_true(self):
     hcl_res = hcl2.loads("""
     resource "github_repository" "test" {
         description   = "test repo"
         name          = "test"
         private       = true
     }
     """)
     resource_conf = hcl_res['resource'][0]['github_repository']['test']
     scan_result = check.scan_resource_conf(conf=resource_conf)
     self.assertEqual(CheckResult.PASSED, scan_result)
Beispiel #3
0
 def test_success_visibility_internal(self):
     hcl_res = hcl2.loads("""
     resource "github_repository" "test" {
         description   = "test repo"
         name          = "test"
         visibility    = "internal"
     }
     """)
     resource_conf = hcl_res['resource'][0]['github_repository']['test']
     scan_result = check.scan_resource_conf(conf=resource_conf)
     self.assertEqual(CheckResult.PASSED, scan_result)
Beispiel #4
0
 def test_success(self):
     hcl_res = hcl2.loads("""
     resource "github_repository" "example" {
         description   = "examplea code"
         name          = "exampla"
         private       = true
     }
     """)
     resource_conf = hcl_res['resource'][0]['github_repository']['example']
     scan_result = check.scan_resource_conf(conf=resource_conf)
     self.assertEqual(CheckResult.PASSED, scan_result)