39 lines
1.4 KiB
PHP
39 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Livewire\Servers\Show;
|
|
use App\Models\Server;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Livewire\Features\SupportTesting\Testable;
|
|
use Livewire\Livewire;
|
|
use Tests\TestCase;
|
|
|
|
class ServerShowSshHintTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
private function show(array $hardening): Testable
|
|
{
|
|
$this->actingAs(User::factory()->create());
|
|
$server = Server::create(['name' => 's', 'ip' => '10.0.0.9', 'ssh_port' => 22, 'status' => 'online']);
|
|
|
|
return Livewire::test(Show::class, ['server' => $server])->set('ready', true)->set('hardening', $hardening);
|
|
}
|
|
|
|
public function test_key_only_hint_shown_when_password_login_on(): void
|
|
{
|
|
$this->show([
|
|
['key' => 'ssh_password', 'label' => 'SSH-Passwort-Login', 'detail' => 'PasswordAuthentication yes', 'featureOn' => true, 'secure' => false, 'supported' => true, 'reason' => null, 'neutral' => false],
|
|
])->assertSee(__('servers.ssh_key_only_hint'));
|
|
}
|
|
|
|
public function test_key_only_hint_hidden_when_password_login_off(): void
|
|
{
|
|
$this->show([
|
|
['key' => 'ssh_password', 'label' => 'SSH-Passwort-Login', 'detail' => 'PasswordAuthentication no', 'featureOn' => false, 'secure' => true, 'supported' => true, 'reason' => null, 'neutral' => false],
|
|
])->assertDontSee(__('servers.ssh_key_only_hint'));
|
|
}
|
|
}
|