mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-12 15:53:46 -04:00
- Remove tests that only check markup, CSS, static text, wire:key strings, framework behavior, copied app logic, or expect(true) - Replace source-grep and Reflection checks of security fixes with tests that run the real code (shell quoting, locked properties, 403 checks, webhook fork trust, log redaction, Sentinel token cleanup) - Assert response bodies and unchanged data on API error paths - Run the Traefik version job through handle() instead of private methods - Update stale tests for scheduled task props, the default Postgres image, and the disabled transfer link of unvalidated servers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
80 lines
2.7 KiB
PHP
80 lines
2.7 KiB
PHP
<?php
|
|
|
|
use App\Models\GithubApp;
|
|
use App\Models\InstanceSettings;
|
|
use App\Models\S3Storage;
|
|
use App\Models\Server;
|
|
use App\Models\StandaloneDocker;
|
|
use App\Models\Team;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
beforeEach(function () {
|
|
InstanceSettings::unguarded(fn () => InstanceSettings::query()->create(['id' => 0]));
|
|
|
|
$this->user = User::factory()->create();
|
|
$this->team = Team::factory()->create();
|
|
$this->user->teams()->attach($this->team, ['role' => 'owner']);
|
|
|
|
$this->actingAs($this->user);
|
|
session(['currentTeam' => $this->team]);
|
|
});
|
|
|
|
it('shows the source name and organization on the source page', function () {
|
|
$githubApp = GithubApp::create([
|
|
'name' => 'coolify-laravel-dev-public',
|
|
'organization' => 'coollabsio',
|
|
'api_url' => 'https://api.github.com',
|
|
'html_url' => 'https://github.com',
|
|
'custom_user' => 'git',
|
|
'custom_port' => 22,
|
|
'app_id' => 12345,
|
|
'installation_id' => 67890,
|
|
'client_id' => 'client-id',
|
|
'client_secret' => 'client-secret',
|
|
'webhook_secret' => 'webhook-secret',
|
|
'team_id' => $this->team->id,
|
|
'is_system_wide' => false,
|
|
]);
|
|
|
|
$response = $this->get(route('source.github.show', ['github_app_uuid' => $githubApp->uuid]));
|
|
|
|
$response->assertSuccessful();
|
|
$response->assertSee('coolify-laravel-dev-public');
|
|
$response->assertSee('GitHub App for coollabsio');
|
|
});
|
|
|
|
it('shows the destination name and network server on the destination page', function () {
|
|
$server = Server::factory()->create(['team_id' => $this->team->id, 'name' => 'prod-server']);
|
|
$destination = StandaloneDocker::query()->where('server_id', $server->id)->firstOrFail();
|
|
$destination->update(['name' => 'coolify']);
|
|
|
|
$response = $this->get(route('destination.show', ['destination_uuid' => $destination->uuid]));
|
|
|
|
$response->assertSuccessful();
|
|
$response->assertSee('coolify');
|
|
$response->assertSee('Docker network on prod-server');
|
|
});
|
|
|
|
it('shows the s3 storage name and description on the storage page', function () {
|
|
$storage = S3Storage::create([
|
|
'name' => 'backup-bucket',
|
|
'description' => 'Primary backup destination',
|
|
'region' => 'us-east-1',
|
|
'key' => 'access-key',
|
|
'secret' => 'secret-key',
|
|
'bucket' => 'coolify-backups',
|
|
'endpoint' => 'https://s3.example.com',
|
|
'team_id' => $this->team->id,
|
|
'is_usable' => true,
|
|
]);
|
|
|
|
$response = $this->get(route('storage.show', ['storage_uuid' => $storage->uuid]));
|
|
|
|
$response->assertSuccessful();
|
|
$response->assertSee('backup-bucket');
|
|
$response->assertSee('Primary backup destination');
|
|
});
|