]> BookStack Code Mirror - bookstack/blobdiff - tests/Api/PagesApiTest.php
Started work on details/summary blocks
[bookstack] / tests / Api / PagesApiTest.php
index eca606234bf4791af06101af8cac011ec63867c9..4eb109d9dec3acf35653740aa51f5af714d122c4 100644 (file)
@@ -292,4 +292,17 @@ class PagesApiTest extends TestCase
         $resp->assertSee('# ' . $page->name);
         $resp->assertHeader('Content-Disposition', 'attachment; filename="' . $page->slug . '.md"');
     }
+
+    public function test_cant_export_when_not_have_permission()
+    {
+        $types = ['html', 'plaintext', 'pdf', 'markdown'];
+        $this->actingAsApiEditor();
+        $this->removePermissionFromUser($this->getEditor(), 'content-export');
+
+        $page = Page::visible()->first();
+        foreach ($types as $type) {
+            $resp = $this->get($this->baseEndpoint . "/{$page->id}/export/{$type}");
+            $this->assertPermissionError($resp);
+        }
+    }
 }