Implement Keystone environment deployments
This commit is contained in:
43
tests/Feature/SourceProviderControllerTest.php
Normal file
43
tests/Feature/SourceProviderControllerTest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\SourceProviderType;
|
||||
use App\Models\Organisation;
|
||||
use App\Models\User;
|
||||
use Inertia\Testing\AssertableInertia;
|
||||
|
||||
it('shows the create source provider page', function () {
|
||||
$user = User::factory()->create();
|
||||
$organisation = Organisation::factory()->create(['owner_id' => $user->id]);
|
||||
|
||||
$response = $this->actingAs($user)->get(route('source-providers.create', [
|
||||
'organisation' => $organisation->id,
|
||||
]));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertInertia(fn (AssertableInertia $page) => $page
|
||||
->component('source-providers/Create', false)
|
||||
->where('sourceProviderTypes.0', SourceProviderType::GITEA->value));
|
||||
});
|
||||
|
||||
it('stores a source provider for repository onboarding', function () {
|
||||
$user = User::factory()->create();
|
||||
$organisation = Organisation::factory()->create(['owner_id' => $user->id]);
|
||||
|
||||
$response = $this->actingAs($user)->post(route('source-providers.store', [
|
||||
'organisation' => $organisation->id,
|
||||
]), [
|
||||
'name' => 'Gitea',
|
||||
'type' => SourceProviderType::GITEA->value,
|
||||
'url' => 'https://gitea.example.com/',
|
||||
]);
|
||||
|
||||
$response->assertRedirect(route('organisations.show', [
|
||||
'organisation' => $organisation->id,
|
||||
]));
|
||||
|
||||
$sourceProvider = $organisation->sourceProviders()->firstOrFail();
|
||||
|
||||
expect($sourceProvider->name)->toBe('Gitea')
|
||||
->and($sourceProvider->type)->toBe(SourceProviderType::GITEA)
|
||||
->and($sourceProvider->url)->toBe('https://gitea.example.com');
|
||||
});
|
||||
Reference in New Issue
Block a user