X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/c429cf78187e80deb63982a282a1c6889f30291a..refs/pull/3039/head:/tests/Api/ChaptersApiTest.php diff --git a/tests/Api/ChaptersApiTest.php b/tests/Api/ChaptersApiTest.php index b3dd0ae6b..c9ed1a289 100644 --- a/tests/Api/ChaptersApiTest.php +++ b/tests/Api/ChaptersApiTest.php @@ -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); + } + } }