Fix Care integration not enabled after provision.
Deploy Ladill Queue / deploy (push) Successful in 58s
Deploy Ladill Queue / deploy (push) Successful in 58s
Queue orgs were created with care_enabled false, blocking counters API; provision now syncs the caller integration flag automatically. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Organization;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class CareIntegrationTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function careHeaders(string $owner = 'care-owner-uuid'): array
|
||||
{
|
||||
config(['qms.service_api_keys.care' => 'test-care-key']);
|
||||
|
||||
return [
|
||||
'Authorization' => 'Bearer test-care-key',
|
||||
'Accept' => 'application/json',
|
||||
];
|
||||
}
|
||||
|
||||
public function test_provision_enables_care_integration(): void
|
||||
{
|
||||
$owner = 'care-owner-uuid';
|
||||
|
||||
$this->postJson('/api/v1/integrations/provision', [
|
||||
'owner' => $owner,
|
||||
'organization_name' => 'Care Clinic',
|
||||
'branch_name' => 'Main',
|
||||
], $this->careHeaders($owner))
|
||||
->assertCreated()
|
||||
->assertJsonPath('data.integrations.care', true);
|
||||
|
||||
$organization = Organization::owned($owner)->first();
|
||||
$this->assertTrue((bool) data_get($organization->settings, 'integrations.care_enabled'));
|
||||
}
|
||||
|
||||
public function test_counters_allowed_after_care_provision(): void
|
||||
{
|
||||
$owner = 'care-owner-uuid';
|
||||
$headers = $this->careHeaders($owner);
|
||||
|
||||
$this->postJson('/api/v1/integrations/provision', [
|
||||
'owner' => $owner,
|
||||
'organization_name' => 'Care Clinic',
|
||||
], $headers)->assertSuccessful();
|
||||
|
||||
$this->getJson('/api/v1/counters?owner='.$owner, $headers)
|
||||
->assertOk();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user