5 class ApiDocsTest extends TestCase
9 protected $endpoint = '/api/docs';
11 public function test_docs_page_not_visible_to_normal_viewers()
13 $viewer = $this->getViewer();
14 $resp = $this->actingAs($viewer)->get($this->endpoint);
15 $resp->assertStatus(403);
17 $resp = $this->actingAsApiEditor()->get($this->endpoint);
18 $resp->assertStatus(200);
21 public function test_docs_page_returns_view_with_docs_content()
23 $resp = $this->actingAsApiEditor()->get($this->endpoint);
24 $resp->assertStatus(200);
25 $resp->assertSee(url('/api/docs.json'));
26 $resp->assertSee('Show a JSON view of the API docs data.');
27 $resp->assertHeader('Content-Type', 'text/html; charset=UTF-8');
30 public function test_docs_json_endpoint_returns_json()
32 $resp = $this->actingAsApiEditor()->get($this->endpoint . '.json');
33 $resp->assertStatus(200);
34 $resp->assertHeader('Content-Type', 'application/json');
37 'name' => 'docs-display',