Skip to content

Commit 9d65fc6

Browse files
committed
adding test step to cover the group_access_token owner access level
1 parent 5508b2f commit 9d65fc6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

internal/provider/resource_gitlab_group_access_token_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ func TestAccGitlabGroupAccessToken_basic(t *testing.T) {
4848
}),
4949
),
5050
},
51+
// Update the Group Access Token Access Level to Owner
52+
{
53+
Config: testAccGitlabGroupAccessTokenUpdateAccessLevel(testGroup.ID),
54+
Check: resource.ComposeTestCheckFunc(
55+
testAccCheckGitlabGroupAccessTokenExists("gitlab_group_access_token.this", &gat),
56+
testAccCheckGitlabGroupAccessTokenAttributes(&gat, &testAccGitlabGroupAccessTokenExpectedAttributes{
57+
name: "my new group token",
58+
scopes: map[string]bool{"read_repository": false, "api": true, "write_repository": false, "read_api": false},
59+
expiresAt: "2099-05-01",
60+
accessLevel: gitlab.AccessLevelValue(gitlab.OwnerPermissions),
61+
}),
62+
),
63+
},
5164
// Add a CICD variable with Group Access Token value
5265
{
5366
Config: testAccGitlabGroupAccessTokenUpdateConfigWithCICDvar(testGroup.ID),
@@ -229,6 +242,18 @@ resource "gitlab_group_access_token" "this" {
229242
`, groupId)
230243
}
231244

245+
func testAccGitlabGroupAccessTokenUpdateAccessLevel(groupId int) string {
246+
return fmt.Sprintf(`
247+
resource "gitlab_group_access_token" "this" {
248+
name = "my new group token"
249+
group = %d
250+
expires_at = "2099-05-01"
251+
access_level = "owner"
252+
scopes = ["api"]
253+
}
254+
`, groupId)
255+
}
256+
232257
func testAccGitlabGroupAccessTokenUpdateConfigWithCICDvar(groupId int) string {
233258
return fmt.Sprintf(`
234259
resource "gitlab_group_access_token" "this" {

0 commit comments

Comments
 (0)