add test testApiAuthenticateCustomerShouldFail

This commit is contained in:
Jérémy Munsch 2021-09-21 14:54:35 +02:00
parent a007b9c565
commit 6149a74cbe
No known key found for this signature in database
GPG key ID: 55196BEE445F6049

View file

@ -64,6 +64,32 @@ class CustomerTest extends ApiBase
$this->assertNotEmpty($json->json('data.hashcode'));
}
/**
* route: apiV2.customers.authenticate
*/
public function testApiAuthenticateCustomerShouldFail()
{
extract($this->getCustomer());
$response = $this->callApiWithToken(
$service,
'post',
route('apiV2.customers.authenticate', []),
[
'email' => $customer->email,
'password' => 'testPasswords'
]
);
$json = $response->decodeResponseJson();
$this->assertApiResponseStatusIs($json, ApiStatus::KO());
$this->assertNotEmpty($json->json('data'));
$this->assertNotEmpty($json->json('data.message'));
$this->assertNotEmpty($json->json('data.code'));
$this->assertEquals(ApiError::authFailed()->value, $json->json('data.code'));
$this->assertEquals(ApiError::authFailed()->label, $json->json('data.message'));
}
/**
* route: apiV2.customers.store
*/