Skip to content

Commit 3171521

Browse files
mikhail-putilovMikhail Putilov
authored andcommitted
Add an acceptance test for a fix (#870)
Signed-off-by: Mikhail Putilov <[email protected]> Signed-off-by: Mikhail Putilov <[email protected]>
1 parent 63dbd7f commit 3171521

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

provider/resource_keycloak_openid_client_test.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,29 @@ func TestAccKeycloakOpenidClient_AccessToken_basic(t *testing.T) {
339339
})
340340
}
341341

342+
func TestAccKeycloakOpenidClient_AccessToken_removed(t *testing.T) {
343+
t.Parallel()
344+
clientId := acctest.RandomWithPrefix("tf-acc")
345+
346+
accessTokenLifespan := "1801"
347+
348+
resource.Test(t, resource.TestCase{
349+
ProviderFactories: testAccProviderFactories,
350+
PreCheck: func() { testAccPreCheck(t) },
351+
CheckDestroy: testAccCheckKeycloakOpenidClientDestroy(),
352+
Steps: []resource.TestStep{
353+
{
354+
Config: testKeycloakOpenidClient_AccessToken_basic(clientId, accessTokenLifespan),
355+
Check: testAccCheckKeycloakOpenidClientExistsWithCorrectLifespan("keycloak_openid_client.client", accessTokenLifespan),
356+
},
357+
{
358+
Config: testKeycloakOpenidClient_AccessToken_removed(clientId),
359+
Check: testAccCheckKeycloakOpenidClientExistsWithCorrectLifespan("keycloak_openid_client.client", ""),
360+
},
361+
},
362+
})
363+
}
364+
342365
func TestAccKeycloakOpenidClient_ClientTimeouts_basic(t *testing.T) {
343366
t.Parallel()
344367
clientId := acctest.RandomWithPrefix("tf-acc")
@@ -1575,6 +1598,20 @@ resource "keycloak_openid_client" "client" {
15751598
`, testAccRealm.Realm, clientId, accessTokenLifespan)
15761599
}
15771600

1601+
func testKeycloakOpenidClient_AccessToken_removed(clientId string) string {
1602+
return fmt.Sprintf(`
1603+
data "keycloak_realm" "realm" {
1604+
realm = "%s"
1605+
}
1606+
1607+
resource "keycloak_openid_client" "client" {
1608+
client_id = "%s"
1609+
realm_id = data.keycloak_realm.realm.id
1610+
access_type = "CONFIDENTIAL"
1611+
}
1612+
`, testAccRealm.Realm, clientId)
1613+
}
1614+
15781615
func testKeycloakOpenidClient_ClientTimeouts(clientId,
15791616
offlineSessionIdleTimeout string, offlineSessionMaxLifespan string,
15801617
sessionIdleTimeout string, sessionMaxLifespan string) string {

0 commit comments

Comments
 (0)