@@ -13,24 +13,30 @@ import (
13
13
func TestAccDataSourceGitlabCurrentUser_basic (t * testing.T ) {
14
14
//The root user has no public email by default, set the public email so it shows up properly.
15
15
_ , _ , _ = testGitlabClient .Users .ModifyUser (1 , & gitlab.ModifyUserOptions {
16
- Email :
gitlab .
String (
"[email protected] " ),
17
16
// The public email MUST match an email on record for the user, or it gets a bad request.
18
17
PublicEmail :
gitlab .
String (
"[email protected] " ),
19
18
})
20
19
20
+ t .Cleanup (func () {
21
+ _ , _ , _ = testGitlabClient .Users .ModifyUser (1 , & gitlab.ModifyUserOptions {
22
+ //Set back to the empty state on test completion.
23
+ PublicEmail : gitlab .String ("" ),
24
+ })
25
+ })
26
+
21
27
resource .Test (t , resource.TestCase {
22
28
ProviderFactories : providerFactories ,
23
29
Steps : []resource.TestStep {
24
30
{
25
31
Config : `data "gitlab_current_user" "this" {}` ,
26
32
Check : resource .ComposeTestCheckFunc (
27
- resource .TestCheckResourceAttrSet ("data.gitlab_current_user.this" , "id" ),
28
- resource .TestCheckResourceAttrSet ("data.gitlab_current_user.this" , "name" ),
29
- resource .TestCheckResourceAttrSet ("data.gitlab_current_user.this" , "username" ),
30
- resource .TestCheckResourceAttrSet ("data.gitlab_current_user.this" , "bot" ),
31
- resource .TestCheckResourceAttrSet ("data.gitlab_current_user.this" , "group_count" ),
32
- resource .TestCheckResourceAttrSet ("data.gitlab_current_user.this" , "namespace_id" ),
33
- resource .TestCheckResourceAttrSet ("data.gitlab_current_user.this" , "public_email" ),
33
+ resource .TestCheckResourceAttr ("data.gitlab_current_user.this" , "id" , "gid://gitlab/User/1 " ),
34
+ resource .TestCheckResourceAttr ("data.gitlab_current_user.this" , "name" , "Administrator " ),
35
+ resource .TestCheckResourceAttr ("data.gitlab_current_user.this" , "username" , "root " ),
36
+ resource .TestCheckResourceAttr ("data.gitlab_current_user.this" , "bot" , "false " ),
37
+ resource .TestCheckResourceAttr ("data.gitlab_current_user.this" , "group_count" , "2 " ),
38
+ resource .TestCheckResourceAttr ("data.gitlab_current_user.this" , "namespace_id" , "gid://gitlab/Namespaces::UserNamespace/1 " ),
39
+ resource .
TestCheckResourceAttr (
"data.gitlab_current_user.this" ,
"public_email" , "[email protected] "),
34
40
),
35
41
},
36
42
},
0 commit comments