File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
tests/Integration/Api/Client/Server Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 33namespace Pterodactyl \Tests \Integration \Api \Client \Server ;
44
55use Carbon \CarbonImmutable ;
6+ use Pterodactyl \Models \User ;
67use Illuminate \Http \Response ;
78use Lcobucci \JWT \Configuration ;
89use Pterodactyl \Models \Permission ;
@@ -27,6 +28,18 @@ public function testSubuserWithoutWebsocketPermissionReceivesError()
2728 ->assertJsonPath ('errors.0.detail ' , 'You do not have permission to connect to this server \'s websocket. ' );
2829 }
2930
31+ /**
32+ * Confirm users cannot access the websocket for another user's server.
33+ */
34+ public function testUserWithoutPermissionForServerReceivesError ()
35+ {
36+ [,$ server ] = $ this ->generateTestAccount ([Permission::ACTION_WEBSOCKET_CONNECT ]);
37+ [$ user ,] = $ this ->generateTestAccount ([Permission::ACTION_WEBSOCKET_CONNECT ]);
38+
39+ $ this ->actingAs ($ user )->getJson ("/api/client/servers/ {$ server ->uuid }/websocket " )
40+ ->assertStatus (Response::HTTP_NOT_FOUND );
41+ }
42+
3043 /**
3144 * Test that the expected permissions are returned for the server owner and that the JWT is
3245 * configured correctly.
You can’t perform that action at this time.
0 commit comments