-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from hashicorp/user_null_fields
Fix bug when removing user attributes
- Loading branch information
Showing
2 changed files
with
55 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,18 @@ func TestAccUser_basic(t *testing.T) { | |
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"initial_password"}, | ||
}, | ||
{ | ||
Config: testAccUserConfigAttributes("dc=yourdomain,dc=com", "testuser", "thu2too'W?ieJ}a^g0zo"), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccUserExists("ad_user.a", "dc=yourdomain,dc=com", "testuser", true), | ||
), | ||
}, | ||
{ | ||
Config: testAccUserConfigBasic("dc=yourdomain,dc=com", "testuser", "thu2too'W?ieJ}a^g0zo"), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccUserExists("ad_user.a", "dc=yourdomain,dc=com", "testuser", true), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
@@ -212,6 +224,42 @@ func testAccUserConfigBasic(domain, username, password string) string { | |
|
||
} | ||
|
||
func testAccUserConfigAttributes(domain, username, password string) string { | ||
return fmt.Sprintf(`%s | ||
resource "ad_user" "a" {%s | ||
city = "City" | ||
company = "Company" | ||
country = "us" | ||
department = "Department" | ||
description = "Description" | ||
division = "Division" | ||
email_address = "[email protected]" | ||
employee_id = "id" | ||
employee_number = "number" | ||
fax = "Fax" | ||
given_name = "GivenName" | ||
home_directory = "HomeDirectory" | ||
home_drive = "HomeDrive" | ||
home_phone = "HomePhone" | ||
home_page = "HomePage" | ||
initials = "Initia" | ||
mobile_phone = "MobilePhone" | ||
office = "Office" | ||
office_phone = "OfficePhone" | ||
organization = "Organization" | ||
other_name = "OtherName" | ||
po_box = "POBox" | ||
postal_code = "PostalCode" | ||
state = "State" | ||
street_address = "StreetAddress" | ||
surname = "Surname" | ||
title = "Title" | ||
smart_card_logon_required = false | ||
trusted_for_delegation = true | ||
}`, defaultVariablesSection(domain, username, password), defaultUserSection("")) | ||
|
||
} | ||
|
||
func testAccUserConfigCustomAttributes(domain, username, password, customAttributes string) string { | ||
return fmt.Sprintf(`%s | ||
resource "ad_user" "a" {%s | ||
|