@@ -26,7 +26,7 @@ func TestAccGitlabUser_basic(t *testing.T) {
26
26
Check : resource .ComposeTestCheckFunc (
27
27
testAccCheckGitlabUserExists ("gitlab_user.foo" , & user ),
28
28
testAccCheckGitlabUserAttributes (& user , & testAccGitlabUserExpectedAttributes {
29
- Email :
"listest%[email protected] " ,
29
+ Email :
fmt . Sprintf ( "listest%[email protected] " , rInt ) ,
30
30
Password : fmt .Sprintf ("test%dtt" , rInt ),
31
31
Username : fmt .Sprintf ("listest%d" , rInt ),
32
32
Name : fmt .Sprintf ("foo %d" , rInt ),
@@ -38,21 +38,21 @@ func TestAccGitlabUser_basic(t *testing.T) {
38
38
}),
39
39
),
40
40
},
41
- // Update the user to change the name
41
+ // Update the user to change the name, email, projects_limit and more
42
42
{
43
43
Config : testAccGitlabUserUpdateConfig (rInt ),
44
44
Check : resource .ComposeTestCheckFunc (
45
45
testAccCheckGitlabUserExists ("gitlab_user.foo" , & user ),
46
46
testAccCheckGitlabUserAttributes (& user , & testAccGitlabUserExpectedAttributes {
47
- Email : "listest%d@ssss .com" ,
47
+ Email : fmt . Sprintf ( "listest%d@tttt .com" , rInt ) ,
48
48
Password : fmt .Sprintf ("test%dtt" , rInt ),
49
49
Username : fmt .Sprintf ("listest%d" , rInt ),
50
50
Name : fmt .Sprintf ("bar %d" , rInt ),
51
51
ProjectsLimit : 10 ,
52
52
Admin : true ,
53
53
CanCreateGroup : true ,
54
54
SkipConfirmation : false ,
55
- External : true ,
55
+ External : false ,
56
56
}),
57
57
),
58
58
},
@@ -62,7 +62,7 @@ func TestAccGitlabUser_basic(t *testing.T) {
62
62
Check : resource .ComposeTestCheckFunc (
63
63
testAccCheckGitlabUserExists ("gitlab_user.foo" , & user ),
64
64
testAccCheckGitlabUserAttributes (& user , & testAccGitlabUserExpectedAttributes {
65
- Email :
"listest%[email protected] " ,
65
+ Email :
fmt . Sprintf ( "listest%[email protected] " , rInt ) ,
66
66
Password : fmt .Sprintf ("test%dtt" , rInt ),
67
67
Username : fmt .Sprintf ("listest%d" , rInt ),
68
68
Name : fmt .Sprintf ("foo %d" , rInt ),
@@ -151,6 +151,26 @@ func testAccCheckGitlabUserAttributes(user *gitlab.User, want *testAccGitlabUser
151
151
return fmt .Errorf ("got username %q; want %q" , user .Username , want .Username )
152
152
}
153
153
154
+ if user .Email != want .Email {
155
+ return fmt .Errorf ("got email %q; want %q" , user .Email , want .Email )
156
+ }
157
+
158
+ if user .CanCreateGroup != want .CanCreateGroup {
159
+ return fmt .Errorf ("got can_create_group %t; want %t" , user .CanCreateGroup , want .CanCreateGroup )
160
+ }
161
+
162
+ if user .External != want .External {
163
+ return fmt .Errorf ("got is_external %t; want %t" , user .External , want .External )
164
+ }
165
+
166
+ if user .IsAdmin != want .Admin {
167
+ return fmt .Errorf ("got is_admin %t; want %t" , user .IsAdmin , want .Admin )
168
+ }
169
+
170
+ if user .ProjectsLimit != want .ProjectsLimit {
171
+ return fmt .Errorf ("got projects_limit %d; want %d" , user .ProjectsLimit , want .ProjectsLimit )
172
+ }
173
+
154
174
return nil
155
175
}
156
176
}
@@ -200,11 +220,11 @@ resource "gitlab_user" "foo" {
200
220
name = "bar %d"
201
221
username = "listest%d"
202
222
password = "test%dtt"
203
- email = "listest%d@ssss .com"
223
+ email = "listest%d@tttt .com"
204
224
is_admin = true
205
225
projects_limit = 10
206
226
can_create_group = true
207
- is_external = true
227
+ is_external = false
208
228
}
209
229
` , rInt , rInt , rInt , rInt )
210
230
}
0 commit comments