1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 00:41:34 +02:00

Fixes for user preference tests

This commit is contained in:
David Bomba 2023-07-05 08:26:26 +10:00
parent 9f54c789a4
commit c7db7c89d7

View File

@ -56,7 +56,7 @@ class UpdateCompanyUserTest extends TestCase
$response = $this->withHeaders([ $response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'), 'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token, 'X-API-TOKEN' => $this->token,
])->put('/api/v1/company_users/'.$this->encodePrimaryKey($this->user->id).'/preferences', $settings); ])->put('/api/v1/company_users/'.$this->encodePrimaryKey($this->user->id).'/preferences?include=company_user', $settings);
} catch (ValidationException $e) { } catch (ValidationException $e) {
$message = json_decode($e->validator->getMessageBag(), 1); $message = json_decode($e->validator->getMessageBag(), 1);
$this->assertNotNull($message); $this->assertNotNull($message);
@ -66,9 +66,8 @@ class UpdateCompanyUserTest extends TestCase
$arr = $response->json(); $arr = $response->json();
$this->assertTrue($arr['data']['react_settings']['show_pdf_preview']); $this->assertTrue($arr['data']['company_user']['react_settings']['show_pdf_preview']);
$this->assertFalse($arr['data']['react_settings']['react_notification_link']); $this->assertFalse($arr['data']['company_user']['react_settings']['react_notification_link']);
$settings = [ $settings = [
'react_settings' => [ 'react_settings' => [
@ -83,7 +82,7 @@ class UpdateCompanyUserTest extends TestCase
$response = $this->withHeaders([ $response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'), 'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token, 'X-API-TOKEN' => $this->token,
])->put('/api/v1/company_users/'.$this->encodePrimaryKey($this->user->id).'/preferences', $settings); ])->put('/api/v1/company_users/'.$this->encodePrimaryKey($this->user->id).'/preferences?include=company_user', $settings);
} catch (ValidationException $e) { } catch (ValidationException $e) {
$message = json_decode($e->validator->getMessageBag(), 1); $message = json_decode($e->validator->getMessageBag(), 1);
$this->assertNotNull($message); $this->assertNotNull($message);
@ -93,8 +92,8 @@ class UpdateCompanyUserTest extends TestCase
$arr = $response->json(); $arr = $response->json();
$this->assertFalse($arr['data']['react_settings']['show_pdf_preview']); $this->assertFalse($arr['data']['company_user']['react_settings']['show_pdf_preview']);
$this->assertTrue($arr['data']['react_settings']['react_notification_link']); $this->assertTrue($arr['data']['company_user']['react_settings']['react_notification_link']);
} }