Fixes for tests

This commit is contained in:
David Bomba 2024-08-22 16:57:13 +10:00
parent c9eb5750b4
commit 74411da11f

View File

@ -258,17 +258,12 @@ class ClientSettingsTest extends TestCase
$response = false; $response = false;
try { $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, ])->postJson('/api/v1/clients/', $data);
])->post('/api/v1/clients/', $data);
} catch (ValidationException $e) { $response->assertStatus(422);
$message = json_decode($e->validator->getMessageBag(), 1);
// nlog($message);
}
$response->assertStatus(302);
} }
public function testClientIllegalPaymenTerms() public function testClientIllegalPaymenTerms()
@ -288,17 +283,13 @@ class ClientSettingsTest extends TestCase
$response = false; $response = false;
try { $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, ])->postJson('/api/v1/clients/', $data);
])->postJson('/api/v1/clients/', $data);
} catch (ValidationException $e) {
$message = json_decode($e->validator->getMessageBag(), 1);
nlog($message);
}
$response->assertStatus(302);
$response->assertStatus(422);
} }
public function testClientIllegalValidUntil() public function testClientIllegalValidUntil()
@ -318,17 +309,14 @@ class ClientSettingsTest extends TestCase
$response = false; $response = false;
try {
$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,
])->post('/api/v1/clients/', $data); ])->postJson('/api/v1/clients/', $data);
} catch (ValidationException $e) {
$message = json_decode($e->validator->getMessageBag(), 1);
nlog($message);
}
$response->assertStatus(302);
$response->assertStatus(422);
} }
public function testClientIllegalDefaultTaskRate() public function testClientIllegalDefaultTaskRate()
@ -381,17 +369,13 @@ class ClientSettingsTest extends TestCase
$response = false; $response = false;
try {
$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,
])->post('/api/v1/clients/', $data); ])->postJson('/api/v1/clients/', $data);
} catch (ValidationException $e) {
$message = json_decode($e->validator->getMessageBag(), 1);
nlog($message);
}
$response->assertStatus(302);
$response->assertStatus(422);
} }
public function testClientSettingBools() public function testClientSettingBools()