Implement Keystone environment deployments
This commit is contained in:
49
tests/Feature/RegistryControllerTest.php
Normal file
49
tests/Feature/RegistryControllerTest.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\RegistryType;
|
||||
use App\Models\Organisation;
|
||||
use App\Models\User;
|
||||
use Inertia\Testing\AssertableInertia;
|
||||
|
||||
it('shows the create registry page', function () {
|
||||
$user = User::factory()->create();
|
||||
$organisation = Organisation::factory()->create(['owner_id' => $user->id]);
|
||||
|
||||
$response = $this->actingAs($user)->get(route('registries.create', [
|
||||
'organisation' => $organisation->id,
|
||||
]));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertInertia(fn (AssertableInertia $page) => $page
|
||||
->component('registries/Create', false)
|
||||
->where('registryTypes.0', RegistryType::GENERIC->value));
|
||||
});
|
||||
|
||||
it('stores a registry for multi-server build artifacts', function () {
|
||||
$user = User::factory()->create();
|
||||
$organisation = Organisation::factory()->create(['owner_id' => $user->id]);
|
||||
|
||||
$response = $this->actingAs($user)->post(route('registries.store', [
|
||||
'organisation' => $organisation->id,
|
||||
]), [
|
||||
'name' => 'GHCR',
|
||||
'type' => RegistryType::GHCR->value,
|
||||
'url' => 'ghcr.io/example/',
|
||||
'username' => 'keystone',
|
||||
'password' => 'secret',
|
||||
]);
|
||||
|
||||
$response->assertRedirect(route('organisations.show', [
|
||||
'organisation' => $organisation->id,
|
||||
]));
|
||||
|
||||
$registry = $organisation->registries()->firstOrFail();
|
||||
|
||||
expect($registry->name)->toBe('GHCR')
|
||||
->and($registry->type)->toBe(RegistryType::GHCR)
|
||||
->and($registry->url)->toBe('ghcr.io/example')
|
||||
->and($registry->credentials)->toMatchArray([
|
||||
'username' => 'keystone',
|
||||
'password' => 'secret',
|
||||
]);
|
||||
});
|
||||
Reference in New Issue
Block a user