refactoring (#116)

- refactoring architecture
- fix incomplete ssh logs
- code editor for scripts in the app
- remove Jobs and SSHCommands
This commit is contained in:
Saeed Vaziry
2024-03-14 20:03:43 +01:00
committed by GitHub
parent cee4a70c3c
commit 428140b931
472 changed files with 24110 additions and 8159 deletions

View File

@ -3,11 +3,9 @@
namespace Tests\Feature;
use App\Enums\SshKeyStatus;
use App\Jobs\SshKey\DeleteSshKeyFromServer;
use App\Jobs\SshKey\DeploySshKeyToServer;
use App\Facades\SSH;
use App\Models\SshKey;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Bus;
use Tests\TestCase;
class ServerKeysTest extends TestCase
@ -34,7 +32,7 @@ public function test_see_server_keys()
public function test_delete_ssh_key()
{
Bus::fake();
SSH::fake();
$this->actingAs($this->user);
@ -50,18 +48,15 @@ public function test_delete_ssh_key()
$this->delete(route('servers.ssh-keys.destroy', [$this->server, $sshKey]));
$this->assertDatabaseHas('server_ssh_keys', [
$this->assertDatabaseMissing('server_ssh_keys', [
'server_id' => $this->server->id,
'ssh_key_id' => $sshKey->id,
'status' => SshKeyStatus::DELETING,
]);
Bus::assertDispatched(DeleteSshKeyFromServer::class);
}
public function test_add_new_ssh_key()
{
Bus::fake();
SSH::fake();
$this->actingAs($this->user);
@ -72,15 +67,13 @@ public function test_add_new_ssh_key()
$this->assertDatabaseHas('server_ssh_keys', [
'server_id' => $this->server->id,
'status' => SshKeyStatus::ADDING,
'status' => SshKeyStatus::ADDED,
]);
Bus::assertDispatched(DeploySshKeyToServer::class);
}
public function test_add_existing_key()
{
Bus::fake();
SSH::fake();
$this->actingAs($this->user);
@ -96,9 +89,7 @@ public function test_add_existing_key()
$this->assertDatabaseHas('server_ssh_keys', [
'server_id' => $this->server->id,
'status' => SshKeyStatus::ADDING,
'status' => SshKeyStatus::ADDED,
]);
Bus::assertDispatched(DeploySshKeyToServer::class);
}
}