mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +00:00
@ -2,13 +2,16 @@
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
|
||||
use App\Http\Livewire\Application\AutoDeployment;
|
||||
use App\Http\Livewire\Application\ChangeBranch;
|
||||
use App\Http\Livewire\Application\Deploy;
|
||||
use App\Http\Livewire\Application\DeploymentScript;
|
||||
use App\Http\Livewire\Application\LaravelApp;
|
||||
use App\Jobs\Site\UpdateBranch;
|
||||
use App\Models\GitHook;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Bus;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Livewire\Livewire;
|
||||
use Tests\TestCase;
|
||||
|
||||
@ -66,4 +69,45 @@ public function test_change_branch()
|
||||
|
||||
Bus::assertDispatched(UpdateBranch::class);
|
||||
}
|
||||
|
||||
public function test_enable_auto_deployment()
|
||||
{
|
||||
Http::fake([
|
||||
'github.com/*' => Http::response([
|
||||
'id' => '123',
|
||||
], 201),
|
||||
]);
|
||||
|
||||
$this->actingAs($this->user);
|
||||
|
||||
Livewire::test(AutoDeployment::class, ['site' => $this->site])
|
||||
->call('enable')
|
||||
->assertSuccessful();
|
||||
|
||||
$this->site->refresh();
|
||||
|
||||
$this->assertTrue($this->site->auto_deployment);
|
||||
}
|
||||
|
||||
public function test_disable_auto_deployment()
|
||||
{
|
||||
Http::fake([
|
||||
'github.com/*' => Http::response([], 204),
|
||||
]);
|
||||
|
||||
$this->actingAs($this->user);
|
||||
|
||||
GitHook::factory()->create([
|
||||
'site_id' => $this->site->id,
|
||||
'source_control_id' => $this->site->source_control_id,
|
||||
]);
|
||||
|
||||
Livewire::test(AutoDeployment::class, ['site' => $this->site])
|
||||
->call('disable')
|
||||
->assertSuccessful();
|
||||
|
||||
$this->site->refresh();
|
||||
|
||||
$this->assertFalse($this->site->auto_deployment);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user