mirror of
https://github.com/flarum/framework.git
synced 2024-11-30 05:13:37 +08:00
Add a test for viewUserList guest permission
This test would have failed without commit 8e3eb59
. Next, I will revert
that commit and most of my PR #1854, so we need this test to ensure the
API continues to behave as desired.
This commit is contained in:
parent
f4219b0de6
commit
26d2031aa4
|
@ -11,6 +11,7 @@
|
|||
|
||||
namespace Flarum\Tests\integration\api\users;
|
||||
|
||||
use Flarum\Group\Permission;
|
||||
use Flarum\Tests\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Tests\integration\TestCase;
|
||||
|
||||
|
@ -28,7 +29,9 @@ class ListTest extends TestCase
|
|||
],
|
||||
'groups' => [
|
||||
$this->adminGroup(),
|
||||
$this->guestGroup(),
|
||||
],
|
||||
'group_permission' => [],
|
||||
'group_user' => [
|
||||
['user_id' => 1, 'group_id' => 1],
|
||||
],
|
||||
|
@ -50,6 +53,25 @@ class ListTest extends TestCase
|
|||
$this->assertEquals(401, $response->getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function shows_index_for_guest_when_they_have_permission()
|
||||
{
|
||||
Permission::unguarded(function () {
|
||||
Permission::create([
|
||||
'permission' => 'viewUserList',
|
||||
'group_id' => 2,
|
||||
]);
|
||||
});
|
||||
|
||||
$response = $this->send(
|
||||
$this->request('GET', '/api/users')
|
||||
);
|
||||
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user