]> BookStack Code Mirror - bookstack/blobdiff - tests/Api/ApiDocsTest.php
Added front-end toggle and testing of inline attachments
[bookstack] / tests / Api / ApiDocsTest.php
index 3cbcadfa30759d4197bbc8775370b0b954760590..1687c64a17e10a7a5110166d251be7c2721afcf1 100644 (file)
@@ -1,5 +1,6 @@
 <?php namespace Tests\Api;
 
+use BookStack\Auth\User;
 use Tests\TestCase;
 
 class ApiDocsTest extends TestCase
@@ -39,4 +40,19 @@ class ApiDocsTest extends TestCase
             ] ]
         ]);
     }
+
+    public function test_docs_page_visible_by_public_user_if_given_permission()
+    {
+        $this->setSettings(['app-public' => true]);
+        $guest = User::getDefault();
+
+        $this->startSession();
+        $resp = $this->get('/api/docs');
+        $resp->assertStatus(403);
+
+        $this->giveUserPermissions($guest, ['access-api']);
+
+        $resp = $this->get('/api/docs');
+        $resp->assertStatus(200);
+    }
 }
\ No newline at end of file