Skip to content

Commit 8574528

Browse files
bevanweissrobmen
authored andcommitted
Add a few more checks on rollback of Util User.
Signed-off-by: Bevan Weiss <bevan.weiss@gmail.com>
1 parent 1afc0bd commit 8574528

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/test/burn/WixTestTools/UserVerifier.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ public static class SIDStrings
4343
/// <param name="userName"></param>
4444
/// <param name="password"></param>
4545
/// <remarks>Has to be run as an Admin</remarks>
46-
public static void CreateLocalUser(string userName, string password)
46+
public static void CreateLocalUser(string userName, string password, string comment = "")
4747
{
4848
DeleteLocalUser(userName);
4949
UserPrincipal newUser = new UserPrincipal(new PrincipalContext(ContextType.Machine));
5050
newUser.SetPassword(password);
5151
newUser.Name = userName;
52-
newUser.Description = String.Empty;
52+
newUser.Description = comment;
5353
newUser.UserCannotChangePassword = true;
5454
newUser.PasswordNeverExpires = false;
5555
newUser.Save();

src/test/msi/WixToolsetTest.MsiE2E/UtilExtensionUserTests.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ public void CanInstallAndUninstallUsers()
4848
[RuntimeFact]
4949
public void CanRollbackUsers()
5050
{
51-
UserVerifier.CreateLocalUser("testName3", "test123!@#");
51+
UserVerifier.CreateLocalUser("testName3", "test123!@#", "User3 comment");
52+
UserVerifier.AddUserToGroup("testName3", "Backup Operators");
5253
var productFail = this.CreatePackageInstaller("ProductFail");
5354

5455
// make sure the user accounts are deleted before we start
@@ -63,6 +64,10 @@ public void CanRollbackUsers()
6364

6465
// Verify that user added to power users group is removed from power users group on rollback.
6566
UserVerifier.VerifyUserIsNotMemberOf("", "testName3", "Power Users");
67+
// but is not removed from Backup Operators
68+
UserVerifier.VerifyUserIsMemberOf(string.Empty, "testName3", "Backup Operators");
69+
// and has their original comment set back
70+
UserVerifier.VerifyUserComment(string.Empty, "testName3", "User3 comment");
6671

6772
// clean up
6873
UserVerifier.DeleteLocalUser("testName1");
@@ -71,7 +76,7 @@ public void CanRollbackUsers()
7176
}
7277

7378

74-
// Verify that command-line parameters aer not blocked by repair switches.
79+
// Verify that command-line parameters are not blocked by repair switches.
7580
// Original code signalled repair mode by using "-f ", which silently
7681
// terminated the command-line parsing, ignoring any parameters that followed.
7782
[RuntimeFact()]

0 commit comments

Comments
 (0)