1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-26 02:52:30 +01:00

Fix integration tests to properly account for the rule position in the API

This commit is contained in:
Dane Everitt 2020-08-27 21:19:01 -07:00
parent f293c73977
commit 1e19e02398
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
9 changed files with 14 additions and 13 deletions

View File

@ -85,7 +85,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
]);
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
$response->assertJsonPath('errors.0.code', 'required');
$response->assertJsonPath('errors.0.meta.rule', 'required');
$response->assertJsonPath('errors.0.detail', 'The email field is required.');
$response = $this->actingAs($user)->putJson('/api/client/account/email', [
@ -94,7 +94,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
]);
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
$response->assertJsonPath('errors.0.code', 'email');
$response->assertJsonPath('errors.0.meta.rule', 'email');
$response->assertJsonPath('errors.0.detail', 'The email must be a valid email address.');
}
@ -156,7 +156,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
]);
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
$response->assertJsonPath('errors.0.code', 'confirmed');
$response->assertJsonPath('errors.0.meta.rule', 'confirmed');
$response->assertJsonPath('errors.0.detail', 'The password confirmation does not match.');
}
}

View File

@ -133,7 +133,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase
]);
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
$response->assertJsonPath('errors.0.code', 'required');
$response->assertJsonPath('errors.0.meta.rule', 'required');
$response->assertJsonPath('errors.0.detail', 'The description field is required.');
}

View File

@ -41,7 +41,7 @@ class CommandControllerTest extends ClientApiIntegrationTestCase
]);
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
$response->assertJsonPath('errors.0.code', 'required');
$response->assertJsonPath('errors.0.meta.rule', 'required');
}
/**

View File

@ -63,7 +63,7 @@ class NetworkAllocationControllerTest extends ClientApiIntegrationTestCase
$this->actingAs($user)->postJson($this->link($allocation), [])
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
->assertJsonPath('errors.0.code', 'present');
->assertJsonPath('errors.0.meta.rule', 'present');
$this->actingAs($user)->postJson($this->link($allocation), ['notes' => 'Test notes'])
->assertOk()

View File

@ -40,7 +40,7 @@ class PowerControllerTest extends ClientApiIntegrationTestCase
]);
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
$response->assertJsonPath('errors.0.code', 'in');
$response->assertJsonPath('errors.0.meta.rule', 'in');
$response->assertJsonPath('errors.0.detail', 'The selected signal is invalid.');
}

View File

@ -71,7 +71,7 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase
'day_of_week' => '*',
])
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
->assertJsonPath('errors.0.code', 'boolean');
->assertJsonPath('errors.0.meta.rule', 'boolean');
}
/**

View File

@ -66,7 +66,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase
'time_offset' => 0,
])
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
->assertJsonPath('errors.0.code', 'in')
->assertJsonPath('errors.0.meta.rule', 'in')
->assertJsonPath('errors.0.source.field', 'action');
$this->actingAs($user)->postJson($this->link($schedule, '/tasks'), [
@ -74,7 +74,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase
'time_offset' => 0,
])
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
->assertJsonPath('errors.0.code', 'required_unless')
->assertJsonPath('errors.0.meta.rule', 'required_unless')
->assertJsonPath('errors.0.source.field', 'payload');
$this->actingAs($user)->postJson($this->link($schedule, '/tasks'), [
@ -84,7 +84,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase
'sequence_id' => 'hodor',
])
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
->assertJsonPath('errors.0.code', 'numeric')
->assertJsonPath('errors.0.meta.rule', 'numeric')
->assertJsonPath('errors.0.source.field', 'sequence_id');
}

View File

@ -28,7 +28,7 @@ class SettingsControllerTest extends ClientApiIntegrationTestCase
]);
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
$response->assertJsonPath('errors.0.code', 'required');
$response->assertJsonPath('errors.0.meta.rule', 'required');
$server = $server->refresh();
$this->assertSame($originalName, $server->name);

View File

@ -64,7 +64,8 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase
]);
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
$response->assertJsonPath('errors.0.code', 'required');
$response->assertJsonPath('errors.0.code', 'ValidationException');
$response->assertJsonPath('errors.0.meta.rule', 'required');
}
/**