Merge pull request 'Add application API keys' (#55) from codex/application-api-keys into main
Reviewed-on: OpenSource/KanbanGit#55
This commit was merged in pull request #55.
This commit is contained in:
@@ -18,12 +18,12 @@ class SettingsApiTest extends TestCase
|
||||
{
|
||||
[$user, $project] = $this->projectContext();
|
||||
|
||||
$this->actingAs($user)
|
||||
$this->withApplicationKey($user)
|
||||
->getJson(route('api.projects.settings.board', $project))
|
||||
->assertOk()
|
||||
->assertJsonPath('data.backlogTicketStatuses.0.name', 'Backlog');
|
||||
|
||||
$columnId = $this->actingAs($user)
|
||||
$columnId = $this->withApplicationKey($user)
|
||||
->postJson(route('api.projects.settings.board.columns.store', $project), [
|
||||
'name' => 'In Review',
|
||||
])
|
||||
@@ -31,7 +31,7 @@ class SettingsApiTest extends TestCase
|
||||
->assertJsonPath('data.name', 'In Review')
|
||||
->json('data.id');
|
||||
|
||||
$this->actingAs($user)
|
||||
$this->withApplicationKey($user)
|
||||
->patchJson(route('api.projects.settings.board.columns.update', [$project, $columnId]), [
|
||||
'name' => 'Review',
|
||||
'position' => 1,
|
||||
@@ -39,7 +39,7 @@ class SettingsApiTest extends TestCase
|
||||
->assertOk()
|
||||
->assertJsonPath('data.name', 'Review');
|
||||
|
||||
$statusId = $this->actingAs($user)
|
||||
$statusId = $this->withApplicationKey($user)
|
||||
->postJson(route('api.projects.settings.board.statuses.store', $project), [
|
||||
'board_column_id' => $columnId,
|
||||
'name' => 'Ready',
|
||||
@@ -47,7 +47,7 @@ class SettingsApiTest extends TestCase
|
||||
->assertCreated()
|
||||
->assertJsonPath('data.name', 'Ready')
|
||||
->json('data.id');
|
||||
$replacementStatusId = $this->actingAs($user)
|
||||
$replacementStatusId = $this->withApplicationKey($user)
|
||||
->postJson(route('api.projects.settings.board.statuses.store', $project), [
|
||||
'board_column_id' => $columnId,
|
||||
'name' => 'QA',
|
||||
@@ -57,14 +57,14 @@ class SettingsApiTest extends TestCase
|
||||
|
||||
$backlogStatus = $project->ticketStatuses()->whereNull('board_column_id')->firstOrFail();
|
||||
|
||||
$this->actingAs($user)
|
||||
$this->withApplicationKey($user)
|
||||
->patchJson(route('api.projects.settings.board.statuses.transitions.update', [$project, $backlogStatus]), [
|
||||
'allowed_ticket_status_ids' => [$statusId],
|
||||
])
|
||||
->assertOk()
|
||||
->assertJsonPath('data.allowed_target_statuses.0.id', $statusId);
|
||||
|
||||
$this->actingAs($user)
|
||||
$this->withApplicationKey($user)
|
||||
->deleteJson(route('api.projects.settings.board.statuses.destroy', [$project, $statusId]))
|
||||
->assertNoContent();
|
||||
|
||||
@@ -72,7 +72,7 @@ class SettingsApiTest extends TestCase
|
||||
'id' => $replacementStatusId,
|
||||
]);
|
||||
|
||||
$this->actingAs($user)
|
||||
$this->withApplicationKey($user)
|
||||
->deleteJson(route('api.projects.settings.board.columns.destroy', [$project, $columnId]))
|
||||
->assertNoContent();
|
||||
}
|
||||
@@ -81,12 +81,12 @@ class SettingsApiTest extends TestCase
|
||||
{
|
||||
[$user, $project] = $this->projectContext();
|
||||
|
||||
$this->actingAs($user)
|
||||
$this->withApplicationKey($user)
|
||||
->getJson(route('api.projects.settings.metadata', $project))
|
||||
->assertOk()
|
||||
->assertJsonPath('data.ticketTypes.0.name', 'Task');
|
||||
|
||||
$this->actingAs($user)
|
||||
$this->withApplicationKey($user)
|
||||
->patchJson(route('api.projects.settings.metadata.update', $project), [
|
||||
'show_author' => false,
|
||||
'show_story_points' => false,
|
||||
@@ -94,7 +94,7 @@ class SettingsApiTest extends TestCase
|
||||
->assertOk()
|
||||
->assertJsonPath('data.show_author', false);
|
||||
|
||||
$typeId = $this->actingAs($user)
|
||||
$typeId = $this->withApplicationKey($user)
|
||||
->postJson(route('api.projects.settings.metadata.types.store', $project), [
|
||||
'is_parent' => true,
|
||||
'name' => 'Epic',
|
||||
@@ -103,7 +103,7 @@ class SettingsApiTest extends TestCase
|
||||
->assertJsonPath('data.name', 'Epic')
|
||||
->json('data.id');
|
||||
|
||||
$this->actingAs($user)
|
||||
$this->withApplicationKey($user)
|
||||
->patchJson(route('api.projects.settings.metadata.types.update', [$project, $typeId]), [
|
||||
'name' => 'Initiative',
|
||||
'position' => 1,
|
||||
@@ -111,14 +111,14 @@ class SettingsApiTest extends TestCase
|
||||
->assertOk()
|
||||
->assertJsonPath('data.name', 'Initiative');
|
||||
|
||||
$priorityId = $this->actingAs($user)
|
||||
$priorityId = $this->withApplicationKey($user)
|
||||
->postJson(route('api.projects.settings.metadata.priorities.store', $project), [
|
||||
'name' => 'Urgent',
|
||||
])
|
||||
->assertCreated()
|
||||
->json('data.id');
|
||||
|
||||
$fieldId = $this->actingAs($user)
|
||||
$fieldId = $this->withApplicationKey($user)
|
||||
->postJson(route('api.projects.settings.metadata.fields.store', $project), [
|
||||
'field_type' => 'number',
|
||||
'label' => 'Risk',
|
||||
@@ -126,26 +126,26 @@ class SettingsApiTest extends TestCase
|
||||
->assertCreated()
|
||||
->json('data.id');
|
||||
|
||||
$linkTypeId = $this->actingAs($user)
|
||||
$linkTypeId = $this->withApplicationKey($user)
|
||||
->postJson(route('api.projects.settings.metadata.link-types.store', $project), [
|
||||
'name' => 'Relates to',
|
||||
])
|
||||
->assertCreated()
|
||||
->json('data.id');
|
||||
|
||||
$this->actingAs($user)
|
||||
$this->withApplicationKey($user)
|
||||
->deleteJson(route('api.projects.settings.metadata.fields.destroy', [$project, $fieldId]))
|
||||
->assertNoContent();
|
||||
|
||||
$this->actingAs($user)
|
||||
$this->withApplicationKey($user)
|
||||
->deleteJson(route('api.projects.settings.metadata.link-types.destroy', [$project, $linkTypeId]))
|
||||
->assertNoContent();
|
||||
|
||||
$this->actingAs($user)
|
||||
$this->withApplicationKey($user)
|
||||
->deleteJson(route('api.projects.settings.metadata.priorities.destroy', [$project, $priorityId]))
|
||||
->assertNoContent();
|
||||
|
||||
$this->actingAs($user)
|
||||
$this->withApplicationKey($user)
|
||||
->deleteJson(route('api.projects.settings.metadata.types.destroy', [$project, $typeId]))
|
||||
->assertNoContent();
|
||||
}
|
||||
@@ -214,7 +214,7 @@ class SettingsApiTest extends TestCase
|
||||
|
||||
[$user, $project] = $this->projectContext();
|
||||
|
||||
$gitConnectionId = $this->actingAs($user)
|
||||
$gitConnectionId = $this->withApplicationKey($user)
|
||||
->postJson(route('api.git-connections.store'), [
|
||||
'api_token' => 'secret-token',
|
||||
'base_url' => 'https://git.example.test/api/v1',
|
||||
@@ -224,12 +224,12 @@ class SettingsApiTest extends TestCase
|
||||
->assertJsonPath('data.account_login', 'api-user')
|
||||
->json('data.id');
|
||||
|
||||
$this->actingAs($user)
|
||||
$this->withApplicationKey($user)
|
||||
->getJson(route('api.git-connections.index'))
|
||||
->assertOk()
|
||||
->assertJsonPath('data.0.id', $gitConnectionId);
|
||||
|
||||
$repositoryConnectionId = $this->actingAs($user)
|
||||
$repositoryConnectionId = $this->withApplicationKey($user)
|
||||
->postJson(route('api.projects.settings.repositories.store', $project), [
|
||||
'provider_repository_id' => '501',
|
||||
'user_git_connection_id' => $gitConnectionId,
|
||||
@@ -238,17 +238,17 @@ class SettingsApiTest extends TestCase
|
||||
->assertJsonPath('data.repository_full_name', 'core-team/kanbangit')
|
||||
->json('data.id');
|
||||
|
||||
$this->actingAs($user)
|
||||
$this->withApplicationKey($user)
|
||||
->getJson(route('api.projects.settings.repositories', $project))
|
||||
->assertOk()
|
||||
->assertJsonPath('data.repositoryConnections.0.id', $repositoryConnectionId)
|
||||
->assertJsonPath('data.availableRepositorySources.0.repositories.0.full_name', 'core-team/kanbangit');
|
||||
|
||||
$this->actingAs($user)
|
||||
$this->withApplicationKey($user)
|
||||
->deleteJson(route('api.projects.settings.repositories.destroy', [$project, $repositoryConnectionId]))
|
||||
->assertNoContent();
|
||||
|
||||
$this->actingAs($user)
|
||||
$this->withApplicationKey($user)
|
||||
->deleteJson(route('api.git-connections.destroy', $gitConnectionId))
|
||||
->assertNoContent();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user