Skip to content

Commit

Permalink
AUT-2035: updating tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleJono committed May 22, 2024
1 parent b708ef7 commit 306f804
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/authsignal/terraform-provider-authsignal
go 1.22.0

require (
github.com/authsignal/authsignal-management-go/v2 v2.1.0
github.com/authsignal/authsignal-management-go/v2 v2.2.0
github.com/hashicorp/terraform-plugin-docs v0.18.0
github.com/hashicorp/terraform-plugin-framework v1.7.0
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI=
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/authsignal/authsignal-management-go/v2 v2.1.0 h1:dg2RaLru412uE2O+18WPGq5io44BC7pgkYCi2qC4+pE=
github.com/authsignal/authsignal-management-go/v2 v2.1.0/go.mod h1:vRrL3bs794IPmy6BMbbmYCyf/QydU8Bg5cgZpCc4G9Q=
github.com/authsignal/authsignal-management-go/v2 v2.2.0 h1:o8IcYTxGOCsiSzkVDUgXiDLsKa5++b7dBo0HZqC901A=
github.com/authsignal/authsignal-management-go/v2 v2.2.0/go.mod h1:vRrL3bs794IPmy6BMbbmYCyf/QydU8Bg5cgZpCc4G9Q=
github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA=
Expand Down
4 changes: 4 additions & 0 deletions internal/provider/action_configuration_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ func TestAccActionConfigurationDataSource(t *testing.T) {
resource.TestCheckResourceAttr("data.authsignal_action_configuration.helloworld", "action_code", "helloworld"),
resource.TestCheckResourceAttr("data.authsignal_action_configuration.helloworld", "tenant_id", "ec3910e7-ab32-479e-b58b-36a122631d58"),
resource.TestCheckResourceAttr("data.authsignal_action_configuration.helloworld", "default_user_action_result", "ALLOW"),
resource.TestCheckResourceAttr("data.authsignal_action_configuration.helloworld", "messaging_templates", `{"en":{"defaultTemplate":"hello world 123"}}`),
resource.TestCheckResourceAttr("data.authsignal_action_configuration.helloworld", "verification_methods.0", "EMAIL_OTP"),
resource.TestCheckResourceAttr("data.authsignal_action_configuration.helloworld", "verification_methods.1", "AUTHENTICATOR_APP"),
resource.TestCheckResourceAttr("data.authsignal_action_configuration.helloworld", "default_verification_method", "AUTHENTICATOR_APP"),
),
},
},
Expand Down
36 changes: 36 additions & 0 deletions internal/provider/action_configuration_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@ func TestAccActionConfigurationResource(t *testing.T) {
resource.TestCheckResourceAttr("authsignal_action_configuration.test-templates", "messaging_templates", "{\"en\":{\"defaultTemplate\":\"hello world\"}}"),
),
},
{
Config: `
resource "authsignal_action_configuration" "test-verification-methods" {
action_code = "terraform-acceptance-test-verification-methods"
default_user_action_result = "ALLOW"
verification_methods = ["EMAIL_OTP", "EMAIL_MAGIC_LINK"]
default_verification_method = "EMAIL_MAGIC_LINK"
}
`,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("authsignal_action_configuration.test-verification-methods", "action_code", "terraform-acceptance-test-verification-methods"),
resource.TestCheckResourceAttr("authsignal_action_configuration.test-verification-methods", "default_user_action_result", "ALLOW"),
resource.TestCheckResourceAttr("authsignal_action_configuration.test-verification-methods", "tenant_id", "ec3910e7-ab32-479e-b58b-36a122631d58"),
resource.TestCheckResourceAttr("authsignal_action_configuration.test-verification-methods", "verification_methods.0", "EMAIL_OTP"),
resource.TestCheckResourceAttr("authsignal_action_configuration.test-verification-methods", "verification_methods.1", "EMAIL_MAGIC_LINK"),
resource.TestCheckResourceAttr("authsignal_action_configuration.test-verification-methods", "default_verification_method", "EMAIL_MAGIC_LINK"),
),
},
// Update and Read testing
{
Config: `
Expand Down Expand Up @@ -76,6 +94,24 @@ func TestAccActionConfigurationResource(t *testing.T) {
resource.TestCheckResourceAttr("authsignal_action_configuration.test-templates", "messaging_templates", "{\"fr\":{\"defaultTemplate\":\"bonjour\"}}"),
),
},
{
Config: `
resource "authsignal_action_configuration" "test-verification-methods" {
action_code = "terraform-acceptance-test-verification-methods"
default_user_action_result = "ALLOW"
verification_methods = ["AUTHENTICATOR_APP", "EMAIL_MAGIC_LINK"]
default_verification_method = "AUTHENTICATOR_APP"
}
`,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("authsignal_action_configuration.test-verification-methods", "action_code", "terraform-acceptance-test-verification-methods"),
resource.TestCheckResourceAttr("authsignal_action_configuration.test-verification-methods", "default_user_action_result", "ALLOW"),
resource.TestCheckResourceAttr("authsignal_action_configuration.test-verification-methods", "tenant_id", "ec3910e7-ab32-479e-b58b-36a122631d58"),
resource.TestCheckResourceAttr("authsignal_action_configuration.test-verification-methods", "verification_methods.0", "AUTHENTICATOR_APP"),
resource.TestCheckResourceAttr("authsignal_action_configuration.test-verification-methods", "verification_methods.1", "EMAIL_MAGIC_LINK"),
resource.TestCheckResourceAttr("authsignal_action_configuration.test-verification-methods", "default_verification_method", "AUTHENTICATOR_APP"),
),
},
// Delete testing automatically occurs in TestCase
},
})
Expand Down

0 comments on commit 306f804

Please sign in to comment.