Skip to content

Commit

Permalink
add must_change_password to test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Alessio Greggi <[email protected]>
  • Loading branch information
alegrey91 committed Aug 2, 2024
1 parent 546e7db commit b36419b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions rancher2/data_source_rancher2_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ data "` + testAccRancher2UserType + `" "foo" {
resource.TestCheckResourceAttr(name, "username", "foo"),
resource.TestCheckResourceAttr(name, "name", "Terraform user acceptance test"),
resource.TestCheckResourceAttr(name, "enabled", "true"),
resource.TestCheckResourceAttr(name, "must_change_password", "true"),
),
},
},
Expand Down
5 changes: 5 additions & 0 deletions rancher2/resource_rancher2_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ resource "` + testAccRancher2UserType + `" "foo" {
username = "foo"
password = "TestACC123456"
enabled = true
must_change_password = true
}
`
testAccRancher2UserUpdate = `
Expand All @@ -34,6 +35,7 @@ resource "` + testAccRancher2UserType + `" "foo" {
username = "foo"
password = "TestACC1234567"
enabled = false
must_change_password = true
}
`
}
Expand All @@ -52,6 +54,7 @@ func TestAccRancher2User_basic(t *testing.T) {
resource.TestCheckResourceAttr(testAccRancher2UserType+".foo", "name", "Terraform user acceptance test"),
resource.TestCheckResourceAttr(testAccRancher2UserType+".foo", "password", "TestACC123456"),
resource.TestCheckResourceAttr(testAccRancher2UserType+".foo", "enabled", "true"),
resource.TestCheckResourceAttr(testAccRancher2UserType+".foo", "must_change_password", "true"),
),
},
{
Expand All @@ -61,6 +64,7 @@ func TestAccRancher2User_basic(t *testing.T) {
resource.TestCheckResourceAttr(testAccRancher2UserType+".foo", "name", "Terraform user acceptance test - Updated"),
resource.TestCheckResourceAttr(testAccRancher2UserType+".foo", "password", "TestACC1234567"),
resource.TestCheckResourceAttr(testAccRancher2UserType+".foo", "enabled", "false"),
resource.TestCheckResourceAttr(testAccRancher2UserType+".foo", "must_change_password", "true"),
),
},
{
Expand All @@ -70,6 +74,7 @@ func TestAccRancher2User_basic(t *testing.T) {
resource.TestCheckResourceAttr(testAccRancher2UserType+".foo", "name", "Terraform user acceptance test"),
resource.TestCheckResourceAttr(testAccRancher2UserType+".foo", "password", "TestACC123456"),
resource.TestCheckResourceAttr(testAccRancher2UserType+".foo", "enabled", "true"),
resource.TestCheckResourceAttr(testAccRancher2UserType+".foo", "must_change_password", "true"),
),
},
},
Expand Down
14 changes: 8 additions & 6 deletions rancher2/structure_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ var (

func init() {
testUserConf = &managementClient.User{
Name: "name",
Username: "username",
Enabled: newTrue(),
Name: "name",
Username: "username",
Enabled: newTrue(),
MustChangePassword: *newTrue(),
}
testUserInterface = map[string]interface{}{
"name": "name",
"username": "username",
"enabled": true,
"name": "name",
"username": "username",
"enabled": true,
"must_change_password": true,
}
}

Expand Down

0 comments on commit b36419b

Please sign in to comment.