From 6149a74cbeabaefdcd245e1f3e1203c5535bca5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Tue, 21 Sep 2021 14:54:35 +0200 Subject: [PATCH] add test testApiAuthenticateCustomerShouldFail --- tests/Feature/ApiV2/CustomerTest.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/Feature/ApiV2/CustomerTest.php b/tests/Feature/ApiV2/CustomerTest.php index bf144b4..fc7ba50 100644 --- a/tests/Feature/ApiV2/CustomerTest.php +++ b/tests/Feature/ApiV2/CustomerTest.php @@ -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 */