@@ -1122,7 +1122,7 @@ func TestUpdateUserPassword(t *testing.T) {
1122
1122
Password : "newpassword" ,
1123
1123
})
1124
1124
require .Error (t , err , "member should not be able to update own password without providing old password" )
1125
- require .ErrorContains (t , err , "Old password is required for non-admin users ." )
1125
+ require .ErrorContains (t , err , "Old password is required." )
1126
1126
})
1127
1127
1128
1128
t .Run ("AuditorCantTellIfPasswordIncorrect" , func (t * testing.T ) {
@@ -1159,7 +1159,7 @@ func TestUpdateUserPassword(t *testing.T) {
1159
1159
require .Equal (t , int32 (http .StatusNotFound ), auditor .AuditLogs ()[numLogs - 1 ].StatusCode )
1160
1160
})
1161
1161
1162
- t .Run ("AdminCanUpdateOwnPasswordWithoutOldPassword " , func (t * testing.T ) {
1162
+ t .Run ("AdminCantUpdateOwnPasswordWithoutOldPassword " , func (t * testing.T ) {
1163
1163
t .Parallel ()
1164
1164
auditor := audit .NewMock ()
1165
1165
client := coderdtest .New (t , & coderdtest.Options {Auditor : auditor })
@@ -1176,7 +1176,8 @@ func TestUpdateUserPassword(t *testing.T) {
1176
1176
})
1177
1177
numLogs ++ // add an audit log for user update
1178
1178
1179
- require .NoError (t , err , "admin should be able to update own password without providing old password" )
1179
+ require .Error (t , err , "admin should not be able to update own password without providing old password" )
1180
+ require .ErrorContains (t , err , "Old password is required." )
1180
1181
1181
1182
require .Len (t , auditor .AuditLogs (), numLogs )
1182
1183
require .Equal (t , database .AuditActionWrite , auditor .AuditLogs ()[numLogs - 1 ].Action )
@@ -1196,7 +1197,8 @@ func TestUpdateUserPassword(t *testing.T) {
1196
1197
require .NoError (t , err )
1197
1198
1198
1199
err = client .UpdateUserPassword (ctx , "me" , codersdk.UpdateUserPasswordRequest {
1199
- Password : "MyNewSecurePassword!" ,
1200
+ OldPassword : "SomeSecurePassword!" ,
1201
+ Password : "MyNewSecurePassword!" ,
1200
1202
})
1201
1203
require .NoError (t , err )
1202
1204
0 commit comments