fix(test): align test setup with project conventions
This commit is contained in:
parent
94700347f8
commit
2f8df2f9bd
1 changed files with 11 additions and 4 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
use App\Models\Environment;
|
use App\Models\Environment;
|
||||||
|
use App\Models\InstanceSettings;
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Models\Service;
|
use App\Models\Service;
|
||||||
|
|
@ -14,6 +15,8 @@
|
||||||
uses(RefreshDatabase::class);
|
uses(RefreshDatabase::class);
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
|
InstanceSettings::create(['id' => 0, 'is_api_enabled' => true]);
|
||||||
|
|
||||||
$this->team = Team::factory()->create();
|
$this->team = Team::factory()->create();
|
||||||
$this->user = User::factory()->create();
|
$this->user = User::factory()->create();
|
||||||
$this->team->members()->attach($this->user->id, ['role' => 'owner']);
|
$this->team->members()->attach($this->user->id, ['role' => 'owner']);
|
||||||
|
|
@ -24,12 +27,12 @@
|
||||||
$this->bearerToken = $this->token->plainTextToken;
|
$this->bearerToken = $this->token->plainTextToken;
|
||||||
|
|
||||||
$this->server = Server::factory()->create(['team_id' => $this->team->id]);
|
$this->server = Server::factory()->create(['team_id' => $this->team->id]);
|
||||||
$this->destination = StandaloneDocker::factory()->create(['server_id' => $this->server->id]);
|
$this->destination = StandaloneDocker::where('server_id', $this->server->id)->first();
|
||||||
$this->project = Project::factory()->create(['team_id' => $this->team->id]);
|
$this->project = Project::factory()->create(['team_id' => $this->team->id]);
|
||||||
$this->environment = Environment::factory()->create(['project_id' => $this->project->id]);
|
$this->environment = $this->project->environments()->first();
|
||||||
|
|
||||||
$this->targetProject = Project::factory()->create(['team_id' => $this->team->id]);
|
$this->targetProject = Project::factory()->create(['team_id' => $this->team->id]);
|
||||||
$this->targetEnvironment = Environment::factory()->create(['project_id' => $this->targetProject->id]);
|
$this->targetEnvironment = $this->targetProject->environments()->first();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('POST /api/v1/applications/{uuid}/move', function () {
|
describe('POST /api/v1/applications/{uuid}/move', function () {
|
||||||
|
|
@ -170,7 +173,11 @@
|
||||||
|
|
||||||
describe('POST /api/v1/databases/{uuid}/move', function () {
|
describe('POST /api/v1/databases/{uuid}/move', function () {
|
||||||
test('moves database to another environment', function () {
|
test('moves database to another environment', function () {
|
||||||
$database = StandalonePostgresql::factory()->create([
|
$database = StandalonePostgresql::create([
|
||||||
|
'name' => 'test-pg',
|
||||||
|
'postgres_user' => 'postgres',
|
||||||
|
'postgres_password' => 'secret',
|
||||||
|
'postgres_db' => 'testdb',
|
||||||
'environment_id' => $this->environment->id,
|
'environment_id' => $this->environment->id,
|
||||||
'destination_id' => $this->destination->id,
|
'destination_id' => $this->destination->id,
|
||||||
'destination_type' => $this->destination->getMorphClass(),
|
'destination_type' => $this->destination->getMorphClass(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue