Fix integration tests to properly account for the rule position in the API
This commit is contained in:
parent
f293c73977
commit
1e19e02398
9 changed files with 14 additions and 13 deletions
|
@ -85,7 +85,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
|
$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->assertJsonPath('errors.0.detail', 'The email field is required.');
|
||||||
|
|
||||||
$response = $this->actingAs($user)->putJson('/api/client/account/email', [
|
$response = $this->actingAs($user)->putJson('/api/client/account/email', [
|
||||||
|
@ -94,7 +94,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
|
$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.');
|
$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->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.');
|
$response->assertJsonPath('errors.0.detail', 'The password confirmation does not match.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
|
$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.');
|
$response->assertJsonPath('errors.0.detail', 'The description field is required.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ class CommandControllerTest extends ClientApiIntegrationTestCase
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
|
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||||
$response->assertJsonPath('errors.0.code', 'required');
|
$response->assertJsonPath('errors.0.meta.rule', 'required');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -63,7 +63,7 @@ class NetworkAllocationControllerTest extends ClientApiIntegrationTestCase
|
||||||
|
|
||||||
$this->actingAs($user)->postJson($this->link($allocation), [])
|
$this->actingAs($user)->postJson($this->link($allocation), [])
|
||||||
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
|
->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'])
|
$this->actingAs($user)->postJson($this->link($allocation), ['notes' => 'Test notes'])
|
||||||
->assertOk()
|
->assertOk()
|
||||||
|
|
|
@ -40,7 +40,7 @@ class PowerControllerTest extends ClientApiIntegrationTestCase
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
|
$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.');
|
$response->assertJsonPath('errors.0.detail', 'The selected signal is invalid.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase
|
||||||
'day_of_week' => '*',
|
'day_of_week' => '*',
|
||||||
])
|
])
|
||||||
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
|
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
|
||||||
->assertJsonPath('errors.0.code', 'boolean');
|
->assertJsonPath('errors.0.meta.rule', 'boolean');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -66,7 +66,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase
|
||||||
'time_offset' => 0,
|
'time_offset' => 0,
|
||||||
])
|
])
|
||||||
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
|
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
|
||||||
->assertJsonPath('errors.0.code', 'in')
|
->assertJsonPath('errors.0.meta.rule', 'in')
|
||||||
->assertJsonPath('errors.0.source.field', 'action');
|
->assertJsonPath('errors.0.source.field', 'action');
|
||||||
|
|
||||||
$this->actingAs($user)->postJson($this->link($schedule, '/tasks'), [
|
$this->actingAs($user)->postJson($this->link($schedule, '/tasks'), [
|
||||||
|
@ -74,7 +74,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase
|
||||||
'time_offset' => 0,
|
'time_offset' => 0,
|
||||||
])
|
])
|
||||||
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
|
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
|
||||||
->assertJsonPath('errors.0.code', 'required_unless')
|
->assertJsonPath('errors.0.meta.rule', 'required_unless')
|
||||||
->assertJsonPath('errors.0.source.field', 'payload');
|
->assertJsonPath('errors.0.source.field', 'payload');
|
||||||
|
|
||||||
$this->actingAs($user)->postJson($this->link($schedule, '/tasks'), [
|
$this->actingAs($user)->postJson($this->link($schedule, '/tasks'), [
|
||||||
|
@ -84,7 +84,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase
|
||||||
'sequence_id' => 'hodor',
|
'sequence_id' => 'hodor',
|
||||||
])
|
])
|
||||||
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
|
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
|
||||||
->assertJsonPath('errors.0.code', 'numeric')
|
->assertJsonPath('errors.0.meta.rule', 'numeric')
|
||||||
->assertJsonPath('errors.0.source.field', 'sequence_id');
|
->assertJsonPath('errors.0.source.field', 'sequence_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ class SettingsControllerTest extends ClientApiIntegrationTestCase
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
|
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||||
$response->assertJsonPath('errors.0.code', 'required');
|
$response->assertJsonPath('errors.0.meta.rule', 'required');
|
||||||
|
|
||||||
$server = $server->refresh();
|
$server = $server->refresh();
|
||||||
$this->assertSame($originalName, $server->name);
|
$this->assertSame($originalName, $server->name);
|
||||||
|
|
|
@ -64,7 +64,8 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
|
$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');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue