server updates (#202)

* server updates

* add last update check
This commit is contained in:
Saeed Vaziry
2024-05-11 10:09:46 +02:00
committed by GitHub
parent bbe3ca802d
commit fe331fd2b3
16 changed files with 229 additions and 10 deletions

View File

@ -280,4 +280,32 @@ public function test_edit_server_ip_address_and_disconnect(): void
'status' => ServerStatus::DISCONNECTED,
]);
}
public function test_check_updates(): void
{
SSH::fake('Available updates:10');
$this->actingAs($this->user);
$this->post(route('servers.settings.check-updates', $this->server))
->assertSessionDoesntHaveErrors();
$this->server->refresh();
$this->assertEquals(9, $this->server->updates);
}
public function test_update_server(): void
{
SSH::fake('Available updates:0');
$this->actingAs($this->user);
$this->post(route('servers.settings.update', $this->server))
->assertSessionDoesntHaveErrors();
$this->server->refresh();
$this->assertEquals(ServerStatus::READY, $this->server->status);
$this->assertEquals(0, $this->server->updates);
}
}