0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-07-04 04:22:59 +00:00
terraform-provider-proxmox/fwprovider/tests/resource_user_test.go
renovate[bot] 48756b69ba
chore(deps): update module github.com/golangci/golangci-lint (v1.56.2 → v1.57.1) in /tools (#1149)
* chore(deps): update module github.com/golangci/golangci-lint (v1.56.2 → v1.57.1) in /tools

| datasource | package                           | from    | to      |
| ---------- | --------------------------------- | ------- | ------- |
| go         | github.com/golangci/golangci-lint | v1.56.2 | v1.57.1 |

* fix linter errors

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-03-25 21:06:06 -04:00

74 lines
2.0 KiB
Go

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package tests
import (
"context"
"testing"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
)
func TestAccResourceUser(t *testing.T) {
tests := []struct {
name string
steps []resource.TestStep
}{
{"create and update user", []resource.TestStep{{
Config: `
resource "proxmox_virtual_environment_user" "user1" {
comment = "Managed by Terraform"
email = "user1@pve"
enabled = true
expiration_date = "2034-01-01T22:00:00Z"
first_name = "First"
last_name = "Last"
//password = "password"
user_id = "user1@pve"
}
`,
Check: resource.ComposeTestCheckFunc(
testResourceAttributes("proxmox_virtual_environment_user.user1", map[string]string{
"comment": "Managed by Terraform",
"email": "user1@pve",
"enabled": "true",
"expiration_date": "2034-01-01T22:00:00Z",
"first_name": "First",
"last_name": "Last",
"user_id": "user1@pve",
}),
),
}, {
Config: `
resource "proxmox_virtual_environment_user" "user1" {
enabled = false
expiration_date = "2035-01-01T22:00:00Z"
user_id = "user1@pve"
first_name = "First One"
}
`,
Check: testResourceAttributes("proxmox_virtual_environment_user.user1", map[string]string{
"enabled": "false",
"expiration_date": "2035-01-01T22:00:00Z",
"first_name": "First One",
"user_id": "user1@pve",
}),
}}},
}
accProviders := testAccMuxProviders(context.Background(), t)
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: accProviders,
Steps: tt.steps,
})
})
}
}