Add application API keys
linter / quality (pull_request) Successful in 1m19s
tests / ci (8.4) (pull_request) Successful in 1m32s

This commit is contained in:
2026-04-20 19:58:24 +02:00
parent a6a4615ad5
commit bf0e50464a
31 changed files with 1124 additions and 46 deletions
+12 -12
View File
@@ -28,7 +28,7 @@ class TicketApiTest extends TestCase
$status = $project->ticketStatuses()->firstOrFail();
$type = $project->ticketTypes()->where('is_parent', false)->firstOrFail();
$this->actingAs($user)
$this->withApplicationKey($user)
->getJson(route('api.projects.ticket-options', [
'project' => $project,
'source' => 'backlog',
@@ -37,7 +37,7 @@ class TicketApiTest extends TestCase
->assertJsonPath('data.defaultTicketStatusId', $status->id)
->assertJsonPath('data.ticketTypes.0.id', $type->id);
$createResponse = $this->actingAs($user)
$createResponse = $this->withApplicationKey($user)
->postJson(route('api.projects.tickets.store', $project), [
'acceptance_criteria' => 'Can sign in',
'description' => 'Build the API-created ticket',
@@ -53,12 +53,12 @@ class TicketApiTest extends TestCase
$ticket = Ticket::query()->findOrFail($createResponse->json('data.id'));
$this->actingAs($user)
$this->withApplicationKey($user)
->getJson(route('api.projects.tickets.index', $project))
->assertOk()
->assertJsonPath('data.0.ticket_key', 'CORE-1');
$this->actingAs($user)
$this->withApplicationKey($user)
->patchJson(route('api.projects.tickets.update', [$project, $ticket]), [
'acceptance_criteria' => 'Can sign in from the API',
'blocked_comment' => null,
@@ -74,7 +74,7 @@ class TicketApiTest extends TestCase
->assertJsonPath('data.title', 'Updated API ticket')
->assertJsonPath('meta.message', 'CORE-1 was updated.');
$this->actingAs($user)
$this->withApplicationKey($user)
->getJson(route('api.projects.tickets.show', [$project, $ticket]))
->assertOk()
->assertJsonPath('data.ticket.ticket_key', 'CORE-1')
@@ -101,13 +101,13 @@ class TicketApiTest extends TestCase
$ticket = $this->ticket($project, $backlogStatus);
$this->actingAs($user)
$this->withApplicationKey($user)
->getJson(route('api.projects.tickets.status-targets', [$project, $ticket]))
->assertOk()
->assertJsonPath('data.current_status.id', $backlogStatus->id)
->assertJsonPath('data.target_statuses.0.id', $doingStatus->id);
$this->actingAs($user)
$this->withApplicationKey($user)
->patchJson(route('api.projects.tickets.status.update', [$project, $ticket]), [
'ticket_status_id' => $doingStatus->id,
])
@@ -157,7 +157,7 @@ class TicketApiTest extends TestCase
'position' => 1,
]);
$this->actingAs($user)
$this->withApplicationKey($user)
->postJson(route('api.projects.tickets.links.store', [$project, $ticket]), [
'linked_ticket_id' => $linkedTicket->id,
'ticket_link_type_id' => $linkType->id,
@@ -181,7 +181,7 @@ class TicketApiTest extends TestCase
'provider' => GitProviderKey::Gitea,
]);
$this->actingAs($user)
$this->withApplicationKey($user)
->getJson(route('api.projects.tickets.branches.validate', [
'project' => $project,
'ticket' => $ticket,
@@ -191,7 +191,7 @@ class TicketApiTest extends TestCase
->assertOk()
->assertJsonPath('data.is_valid', true);
$this->actingAs($user)
$this->withApplicationKey($user)
->postJson(route('api.projects.tickets.branches.store', [$project, $ticket]), [
'branch_name' => 'core-1-api-ticket',
'repository_connection_id' => $repositoryConnection->id,
@@ -219,12 +219,12 @@ class TicketApiTest extends TestCase
'position' => 1,
]);
$this->actingAs($user)
$this->withApplicationKey($user)
->getJson(route('api.projects.backlog', $project))
->assertOk()
->assertJsonPath('data.tickets.0.id', $ticket->id);
$this->actingAs($user)
$this->withApplicationKey($user)
->getJson(route('api.projects.board', $project))
->assertOk()
->assertJsonPath('data.boardColumns.0.name', 'Todo');