@@ -139,6 +139,7 @@ describe("2370: Change password", () => {
139
139
. send ( {
140
140
currentPassword : "wrongOldPassword" ,
141
141
newPassword : TestData . Accounts [ "user1" ] [ "password" ] ,
142
+ confirmPassword : TestData . Accounts [ "user1" ] [ "password" ] ,
142
143
} )
143
144
. set ( "Accept" , "application/json" )
144
145
. set ( { Authorization : `Bearer ${ accessTokenUser1 } ` } )
@@ -151,12 +152,32 @@ describe("2370: Change password", () => {
151
152
} ) ;
152
153
} ) ;
153
154
154
- it ( "0020: should change own password successfully" , async ( ) => {
155
+ it ( "0020: should fail when new password and confirmation password do not match" , async ( ) => {
156
+ return request ( appUrl )
157
+ . post ( "/api/v3/users/password" )
158
+ . send ( {
159
+ currentPassword : "wrongOldPassword" ,
160
+ newPassword : TestData . Accounts [ "user1" ] [ "password" ] ,
161
+ confirmPassword : "wrongConfirmPassword" ,
162
+ } )
163
+ . set ( "Accept" , "application/json" )
164
+ . set ( { Authorization : `Bearer ${ accessTokenUser1 } ` } )
165
+ . expect ( TestData . BadRequestStatusCode )
166
+ . then ( ( res ) => {
167
+ res . body . should . have . property (
168
+ "message" ,
169
+ "New password and confirmation password do not match" ,
170
+ ) ;
171
+ } ) ;
172
+ } ) ;
173
+
174
+ it ( "0030: should change own password successfully" , async ( ) => {
155
175
return request ( appUrl )
156
176
. post ( "/api/v3/users/password" )
157
177
. send ( {
158
178
currentPassword : TestData . Accounts [ "user1" ] [ "password" ] ,
159
179
newPassword : "testpassword" ,
180
+ confirmPassword : "testpassword" ,
160
181
} )
161
182
. set ( "Accept" , "application/json" )
162
183
. set ( { Authorization : `Bearer ${ accessTokenUser1 } ` } )
@@ -168,12 +189,14 @@ describe("2370: Change password", () => {
168
189
) ;
169
190
} ) ;
170
191
} ) ;
171
- it ( "0030: oidc user should fail to change password" , async ( ) => {
192
+
193
+ it ( "0040: oidc user should fail to change password" , async ( ) => {
172
194
return request ( appUrl )
173
195
. post ( "/api/v3/users/password" )
174
196
. send ( {
175
197
currentPassword : TestData . Accounts [ "user2" ] [ "password" ] ,
176
198
newPassword : "testpassword" ,
199
+ confirmPassword : "testpassword" ,
177
200
} )
178
201
. set ( "Accept" , "application/json" )
179
202
. set ( { Authorization : `Bearer ${ accessTokenUser2 } ` } )
@@ -186,11 +209,30 @@ describe("2370: Change password", () => {
186
209
} ) ;
187
210
} ) ;
188
211
189
- it ( "0040: admin should be able to change user password" , async ( ) => {
212
+ it ( "0050: admin should fail to change password for user when new and confirmation passwords do not match" , async ( ) => {
213
+ return request ( appUrl )
214
+ . patch ( `/api/v3/users/${ userIdUser1 } /password` )
215
+ . send ( {
216
+ newPassword : TestData . Accounts [ "user1" ] [ "password" ] ,
217
+ confirmPassword : "wrongConfirmPassword" ,
218
+ } )
219
+ . set ( "Accept" , "application/json" )
220
+ . set ( { Authorization : `Bearer ${ accessTokenAdminIngestor } ` } )
221
+ . expect ( TestData . BadRequestStatusCode )
222
+ . then ( ( res ) => {
223
+ res . body . should . have . property (
224
+ "message" ,
225
+ "New password and confirmation password do not match" ,
226
+ ) ;
227
+ } ) ;
228
+ } ) ;
229
+
230
+ it ( "0060: admin should be able to change user password" , async ( ) => {
190
231
return request ( appUrl )
191
232
. patch ( `/api/v3/users/${ userIdUser1 } /password` )
192
233
. send ( {
193
234
newPassword : TestData . Accounts [ "user1" ] [ "password" ] ,
235
+ confirmPassword : TestData . Accounts [ "user1" ] [ "password" ] ,
194
236
} )
195
237
. set ( "Accept" , "application/json" )
196
238
. set ( { Authorization : `Bearer ${ accessTokenAdminIngestor } ` } )
@@ -203,11 +245,12 @@ describe("2370: Change password", () => {
203
245
} ) ;
204
246
} ) ;
205
247
206
- it ( "0050 : admin should fail to change oidc user password" , async ( ) => {
248
+ it ( "0070 : admin should fail to change oidc user password" , async ( ) => {
207
249
return request ( appUrl )
208
250
. patch ( `/api/v3/users/${ userIdUser2 } /password` )
209
251
. send ( {
210
252
newPassword : "testpassword" ,
253
+ confirmPassword : "testpassword" ,
211
254
} )
212
255
. set ( "Accept" , "application/json" )
213
256
. set ( { Authorization : `Bearer ${ accessTokenAdminIngestor } ` } )
0 commit comments