Skip to content

Commit

Permalink
Fix remaining configuration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pablothedude committed Nov 11, 2024
1 parent adf7350 commit 7065264
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,34 @@

use DateTime;
use Ramsey\Uuid\Uuid;
use Surfnet\Stepup\Helper\JsonHelper;
use Surfnet\StepupMiddleware\ApiBundle\Exception\BadCommandRequestException;
use Surfnet\StepupMiddleware\CommandHandlingBundle\Command\AbstractCommand;
use Surfnet\StepupMiddleware\CommandHandlingBundle\Configuration\Command\UpdateConfigurationCommand;
use Surfnet\StepupMiddleware\CommandHandlingBundle\Pipeline\TransactionAwarePipeline;
use Surfnet\StepupMiddleware\ManagementBundle\Validator\Constraints\HasValidConfigurationStructure;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Validator\Validator\ValidatorInterface;

class ConfigurationController extends AbstractController
{
public function __construct(
private readonly TransactionAwarePipeline $pipeline,
private readonly ValidatorInterface $validator,
) {
}

public function update(Request $request): JsonResponse
{
$this->denyAccessUnlessGranted('ROLE_MANAGEMENT');

$violations = $this->validator->validate($request->getContent(), new HasValidConfigurationStructure());
if ($violations->count() > 0) {
throw BadCommandRequestException::withViolations('Invalid configure institutions request', $violations);
}

$command = new UpdateConfigurationCommand();
$command->configuration = $request->getContent();
$command->UUID = (string)Uuid::uuid4();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

return [
'expectedPropertyPath' => 'Institution(surfnet.nl)',
'expectErrorMessageToContain' => 'All values of option "use_raa" should be known institutions.',
'expectErrorMessageToContain' => 'All values of option "use_raa" for "surfnet.nl" should be known institutions.',
'reconfigureInstitutionRequest' => [
'surfnet.nl' => [
"use_ra_locations" => true,
Expand Down

0 comments on commit 7065264

Please sign in to comment.