added it_get_settings, it_try_get_secured_settings_via_public_api test

This commit is contained in:
Peter Papp
2021-03-12 17:17:53 +01:00
parent b837cc1906
commit b022cde9e0
4 changed files with 77 additions and 58 deletions

View File

@@ -4,12 +4,8 @@ namespace Tests\Feature\App;
use App\Http\Mail\SendContactMessage;
use App\Models\Setting;
use App\Notifications\SharedSendViaEmail;
use App\Services\SetupService;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Support\Facades\Notification;
use Mail;
use Tests\TestCase;
@@ -70,4 +66,41 @@ class AppTest extends TestCase
Mail::assertSent(SendContactMessage::class);
}
/**
* @test
*/
public function it_get_settings()
{
Setting::create([
'name' => 'get_started_title',
'value' => 'Hello World!',
]);
Setting::create([
'name' => 'pricing_description',
'value' => 'Give me a money!',
]);
$this->getJson('/api/content?column=get_started_title|pricing_description')
->assertStatus(200)
->assertExactJson([
"get_started_title" => "Hello World!",
"pricing_description" => "Give me a money!",
]);
}
/**
* @test
*/
public function it_try_get_secured_settings_via_public_api()
{
Setting::create([
'name' => 'purchase_code',
'value' => '15a53561-d387-4e0a-8de1-5d1bff34c1ed',
]);
$this->getJson('/api/content?column=purchase_code')
->assertStatus(401);
}
}