mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
@ -29,6 +29,26 @@ public function test_create_database_user(): void
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_create_database_user_with_remote(): void
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
|
||||
SSH::fake();
|
||||
|
||||
$this->post(route('servers.databases.users.store', $this->server), [
|
||||
'username' => 'user',
|
||||
'password' => 'password',
|
||||
'remote' => 'on',
|
||||
'host' => '%',
|
||||
])->assertSessionDoesntHaveErrors();
|
||||
|
||||
$this->assertDatabaseHas('database_users', [
|
||||
'username' => 'user',
|
||||
'host' => '%',
|
||||
'status' => DatabaseUserStatus::READY,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_see_database_users_list(): void
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
@ -58,4 +78,26 @@ public function test_delete_database_user(): void
|
||||
'id' => $databaseUser->id,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_unlink_database(): void
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
|
||||
SSH::fake();
|
||||
|
||||
$databaseUser = DatabaseUser::factory()->create([
|
||||
'server_id' => $this->server,
|
||||
]);
|
||||
|
||||
$this->post(route('servers.databases.users.link', [
|
||||
'server' => $this->server,
|
||||
'databaseUser' => $databaseUser,
|
||||
]), [])
|
||||
->assertSessionDoesntHaveErrors();
|
||||
|
||||
$this->assertDatabaseHas('database_users', [
|
||||
'username' => $databaseUser->username,
|
||||
'databases' => json_encode([]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user