]> BookStack Code Mirror - bookstack/blobdiff - tests/Api/ChaptersApiTest.php
Added test for logical-theme-system command registration
[bookstack] / tests / Api / ChaptersApiTest.php
index b3dd0ae6b408ecb20badca3dcb552b193f8da3eb..c9ed1a2892e19a715dd344e4a4ac8e6b5302b41a 100644 (file)
@@ -200,4 +200,17 @@ class ChaptersApiTest extends TestCase
         $resp->assertSee('# ' . $chapter->name);
         $resp->assertSee('# ' . $chapter->pages()->first()->name);
     }
+
+    public function test_cant_export_when_not_have_permission()
+    {
+        $types = ['html', 'plaintext', 'pdf', 'markdown'];
+        $this->actingAsApiEditor();
+        $this->removePermissionFromUser($this->getEditor(), 'content-export');
+
+        $chapter = Chapter::visible()->has('pages')->first();
+        foreach ($types as $type) {
+            $resp = $this->get($this->baseEndpoint . "/{$chapter->id}/export/{$type}");
+            $this->assertPermissionError($resp);
+        }
+    }
 }