Skip to content

Commit 05bfb1c

Browse files
committed
add test for not existing policy
1 parent 05ecbb2 commit 05bfb1c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

internal/provider/data_source_policy_test.go

+11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package provider
22

33
import (
4+
"regexp"
45
"testing"
56

67
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
@@ -17,6 +18,10 @@ func TestAccDataSourcePolicy(t *testing.T) {
1718
resource.TestCheckResourceAttr("data.authentik_policy.default-authentication-flow-password-stage", "name", "default-authentication-flow-password-stage"),
1819
),
1920
},
21+
{
22+
Config: testAccDataSourcePolicyNotExisting,
23+
ExpectError: regexp.MustCompile(`No matching policy found`),
24+
},
2025
},
2126
})
2227
}
@@ -26,3 +31,9 @@ data "authentik_policy" "default-authentication-flow-password-stage" {
2631
name = "default-authentication-flow-password-stage"
2732
}
2833
`
34+
35+
const testAccDataSourcePolicyNotExisting = `
36+
data "authentik_policy" "not-exiting-policy" {
37+
name = "not-exiting-policy"
38+
}
39+
`

0 commit comments

Comments
 (0)