mirror of
https://github.com/pelican-dev/panel.git
synced 2025-06-22 01:11:07 +02:00
Fix some tests (#1450)
This commit is contained in:
parent
6107524522
commit
c61b6920b9
@ -34,13 +34,14 @@ class SettingsController extends ClientApiController
|
||||
*/
|
||||
public function rename(RenameServerRequest $request, Server $server): JsonResponse
|
||||
{
|
||||
$originalName = $server->name;
|
||||
$name = $request->input('name');
|
||||
|
||||
$server->update(['name' => $name]);
|
||||
|
||||
if ($server->wasChanged('name')) {
|
||||
Activity::event('server:settings.rename')
|
||||
->property(['old' => $server->getOriginal('name'), 'new' => $name])
|
||||
->property(['old' => $originalName, 'new' => $name])
|
||||
->log();
|
||||
}
|
||||
|
||||
@ -56,12 +57,13 @@ class SettingsController extends ClientApiController
|
||||
return new JsonResponse([], Response::HTTP_FORBIDDEN);
|
||||
}
|
||||
|
||||
$originalDescription = $server->description;
|
||||
$description = $request->input('description');
|
||||
$server->update(['description' => $description ?? '']);
|
||||
|
||||
if ($server->wasChanged('description')) {
|
||||
Activity::event('server:settings.description')
|
||||
->property(['old' => $server->getOriginal('description'), 'new' => $description])
|
||||
->property(['old' => $originalDescription, 'new' => $description])
|
||||
->log();
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ it('server description can be changed', function () {
|
||||
expect()->toLogActivities(1)
|
||||
->and($logged->properties['old'])->toBe($originalDescription)
|
||||
->and($logged->properties['new'])->toBe($newDescription)
|
||||
->and($server->description)->not()->toBe($originalDescription);
|
||||
->and($server->description)->toBe($newDescription);
|
||||
});
|
||||
|
||||
it('server description cannot be changed', function () {
|
||||
@ -53,7 +53,7 @@ it('server description cannot be changed', function () {
|
||||
->post("/api/client/servers/$server->uuid/settings/description", [
|
||||
'description' => 'Test Description',
|
||||
])
|
||||
->assertStatus(Response::HTTP_NO_CONTENT);
|
||||
->assertStatus(Response::HTTP_FORBIDDEN);
|
||||
|
||||
$server = $server->refresh();
|
||||
expect()->toLogActivities(0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user