Add test coverage for allocation assignment endpoint

This commit is contained in:
Dane Everitt 2020-10-31 21:57:27 -07:00
parent b2be067f38
commit d493685518
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
6 changed files with 204 additions and 79 deletions

View file

@ -122,6 +122,12 @@ class NetworkAllocationController extends ClientApiController
*/
public function store(NewAllocationRequest $request, Server $server): array
{
if ($server->allocations()->count() >= $server->allocation_limit) {
throw new DisplayException(
'Cannot assign additional allocations to this server: limit has been reached.'
);
}
$allocation = $this->assignableAllocationService->handle($server);
return $this->fractal->item($allocation)