-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(user):
expiration_date
attribute handling (#1066)
Signed-off-by: Pavel Boldyrev <[email protected]>
- Loading branch information
Showing
13 changed files
with
127 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* 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-sdk/v2/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: resource.ComposeTestCheckFunc( | ||
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 { | ||
tt := tt | ||
t.Run(tt.name, func(t *testing.T) { | ||
resource.Test(t, resource.TestCase{ | ||
ProtoV6ProviderFactories: accProviders, | ||
Steps: tt.steps, | ||
}) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters