@@ -39,6 +39,16 @@ func TestAccUserDataSource(t *testing.T) {
39
39
Name : "Example User" ,
40
40
})
41
41
require .NoError (t , err )
42
+
43
+ checkFn := resource .ComposeAggregateTestCheckFunc (
44
+ resource .TestCheckResourceAttr ("data.coderd_user.test" , "username" , "example" ),
45
+ resource .TestCheckResourceAttr ("data.coderd_user.test" , "name" , "Example User" ),
46
+ resource .
TestCheckResourceAttr (
"data.coderd_user.test" ,
"email" ,
"[email protected] " ),
47
+ resource .TestCheckResourceAttr ("data.coderd_user.test" , "roles.#" , "1" ),
48
+ resource .TestCheckResourceAttr ("data.coderd_user.test" , "roles.0" , "auditor" ),
49
+ resource .TestCheckResourceAttr ("data.coderd_user.test" , "login_type" , "password" ),
50
+ resource .TestCheckResourceAttr ("data.coderd_user.test" , "suspended" , "false" ),
51
+ )
42
52
t .Run ("UserByUsername" , func (t * testing.T ) {
43
53
cfg := testAccUserDataSourceConfig {
44
54
URL : client .URL .String (),
@@ -51,15 +61,7 @@ func TestAccUserDataSource(t *testing.T) {
51
61
Steps : []resource.TestStep {
52
62
{
53
63
Config : cfg .String (t ),
54
- Check : resource .ComposeAggregateTestCheckFunc (
55
- resource .TestCheckResourceAttr ("data.coderd_user.test" , "username" , "example" ),
56
- resource .TestCheckResourceAttr ("data.coderd_user.test" , "name" , "Example User" ),
57
- resource .
TestCheckResourceAttr (
"data.coderd_user.test" ,
"email" ,
"[email protected] " ),
58
- resource .TestCheckResourceAttr ("data.coderd_user.test" , "roles.#" , "1" ),
59
- resource .TestCheckResourceAttr ("data.coderd_user.test" , "roles.0" , "auditor" ),
60
- resource .TestCheckResourceAttr ("data.coderd_user.test" , "login_type" , "password" ),
61
- resource .TestCheckResourceAttr ("data.coderd_user.test" , "suspended" , "false" ),
62
- ),
64
+ Check : checkFn ,
63
65
},
64
66
},
65
67
})
@@ -78,15 +80,7 @@ func TestAccUserDataSource(t *testing.T) {
78
80
Steps : []resource.TestStep {
79
81
{
80
82
Config : cfg .String (t ),
81
- Check : resource .ComposeAggregateTestCheckFunc (
82
- resource .TestCheckResourceAttr ("data.coderd_user.test" , "username" , "example" ),
83
- resource .TestCheckResourceAttr ("data.coderd_user.test" , "name" , "Example User" ),
84
- resource .
TestCheckResourceAttr (
"data.coderd_user.test" ,
"email" ,
"[email protected] " ),
85
- resource .TestCheckResourceAttr ("data.coderd_user.test" , "roles.#" , "1" ),
86
- resource .TestCheckResourceAttr ("data.coderd_user.test" , "roles.0" , "auditor" ),
87
- resource .TestCheckResourceAttr ("data.coderd_user.test" , "login_type" , "password" ),
88
- resource .TestCheckResourceAttr ("data.coderd_user.test" , "suspended" , "false" ),
89
- ),
83
+ Check : checkFn ,
90
84
},
91
85
},
92
86
})
0 commit comments