Skip to content

Commit 51b1e51

Browse files
committed
WIP: Working on testing improvement
1 parent a6ee1cc commit 51b1e51

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

coderd/users_test.go

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,22 +1084,24 @@ func TestUpdateUserPassword(t *testing.T) {
10841084
require.Equal(t, database.AuditActionWrite, auditor.AuditLogs()[numLogs-1].Action)
10851085
})
10861086

1087-
// FIXME: Re-enable the tests once real logic changed
1087+
// FIXME: Re-enable the tests once real logic changed
10881088
// Currently there's no check in code to validate that users have to put the old password
1089-
// t.Run("MemberCantUpdateOwnPasswordWithoutOldPassword", func(t *testing.T) {
1090-
// t.Parallel()
1091-
// client := coderdtest.New(t, nil)
1092-
// owner := coderdtest.CreateFirstUser(t, client)
1093-
// member, _ := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID)
1094-
1095-
// ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
1096-
// defer cancel()
1097-
1098-
// err := member.UpdateUserPassword(ctx, "me", codersdk.UpdateUserPasswordRequest{
1099-
// Password: "newpassword",
1100-
// })
1101-
// require.Error(t, err, "member should not be able to update own password without providing old password")
1102-
// })
1089+
t.Run("MemberCantUpdateOwnPasswordWithoutOldPassword", func(t *testing.T) {
1090+
t.Skip()
1091+
1092+
t.Parallel()
1093+
client := coderdtest.New(t, nil)
1094+
owner := coderdtest.CreateFirstUser(t, client)
1095+
member, _ := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID)
1096+
1097+
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
1098+
defer cancel()
1099+
1100+
err := member.UpdateUserPassword(ctx, "me", codersdk.UpdateUserPasswordRequest{
1101+
Password: "newpassword",
1102+
})
1103+
require.Error(t, err, "member should not be able to update own password without providing old password")
1104+
})
11031105

11041106
t.Run("AuditorCantTellIfPasswordIncorrect", func(t *testing.T) {
11051107
t.Parallel()

0 commit comments

Comments
 (0)