Skip to content

Commit 7f0eaa8

Browse files
30179: resetPassword mutation returns generic error - added API-functional test
1 parent 80dc6c8 commit 7f0eaa8

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,52 @@ public function testNewPasswordEmptyValue()
192192
$this->graphQlMutation($query);
193193
}
194194

195+
/**
196+
* @magentoApiDataFixture Magento/Customer/_files/customer.php
197+
*
198+
* @throws NoSuchEntityException
199+
* @throws Exception
200+
* @throws LocalizedException
201+
*/
202+
public function testNewPasswordCheckMinLength()
203+
{
204+
$this->expectException(\Exception::class);
205+
$this->expectExceptionMessage('The password needs at least 8 characters. Create a new password and try again');
206+
$query = <<<QUERY
207+
mutation {
208+
resetPassword (
209+
email: "{$this->getCustomerEmail()}"
210+
resetPasswordToken: "{$this->getResetPasswordToken()}"
211+
newPassword: "new_"
212+
)
213+
}
214+
QUERY;
215+
$this->graphQlMutation($query);
216+
}
217+
218+
/**
219+
* @magentoApiDataFixture Magento/Customer/_files/customer.php
220+
*
221+
* @throws NoSuchEntityException
222+
* @throws Exception
223+
* @throws LocalizedException
224+
*/
225+
public function testNewPasswordCheckCharactersStrenth()
226+
{
227+
$this->expectException(\Exception::class);
228+
$this->expectExceptionMessage('Minimum of different classes of characters in password is 3. Classes of characters: Lower Case, Upper Case, Digits, Special Characters.');
229+
$query = <<<QUERY
230+
mutation {
231+
resetPassword (
232+
email: "{$this->getCustomerEmail()}"
233+
resetPasswordToken: "{$this->getResetPasswordToken()}"
234+
newPassword: "new_password"
235+
)
236+
}
237+
QUERY;
238+
$this->graphQlMutation($query);
239+
}
240+
195241
/**
196242
* Check password reset for lock customer
197243
*

0 commit comments

Comments
 (0)