Add application API keys
This commit is contained in:
@@ -17,12 +17,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',
|
||||
])
|
||||
@@ -30,7 +30,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,
|
||||
@@ -38,7 +38,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',
|
||||
@@ -46,7 +46,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',
|
||||
@@ -56,14 +56,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();
|
||||
|
||||
@@ -71,7 +71,7 @@ class SettingsApiTest extends TestCase
|
||||
'id' => $replacementStatusId,
|
||||
]);
|
||||
|
||||
$this->actingAs($user)
|
||||
$this->withApplicationKey($user)
|
||||
->deleteJson(route('api.projects.settings.board.columns.destroy', [$project, $columnId]))
|
||||
->assertNoContent();
|
||||
}
|
||||
@@ -80,12 +80,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,
|
||||
@@ -93,7 +93,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',
|
||||
@@ -102,7 +102,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,
|
||||
@@ -110,14 +110,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',
|
||||
@@ -125,26 +125,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();
|
||||
}
|
||||
@@ -174,7 +174,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',
|
||||
@@ -184,12 +184,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,
|
||||
@@ -198,17 +198,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