33namespace Pterodactyl \Tests \Integration \Api \Application \Location ;
44
55use Pterodactyl \Models \Node ;
6+ use Illuminate \Http \Response ;
67use Pterodactyl \Models \Location ;
78use Pterodactyl \Transformers \Api \Application \NodeTransformer ;
89use Pterodactyl \Transformers \Api \Application \ServerTransformer ;
@@ -17,8 +18,8 @@ public function testGetLocations()
1718 {
1819 $ locations = factory (Location::class)->times (2 )->create ();
1920
20- $ response = $ this ->json ( ' GET ' , '/api/application/locations ' );
21- $ response ->assertStatus (200 );
21+ $ response = $ this ->getJson ( '/api/application/locations ' );
22+ $ response ->assertStatus (Response:: HTTP_OK );
2223 $ response ->assertJsonCount (2 , 'data ' );
2324 $ response ->assertJsonStructure ([
2425 'object ' ,
@@ -71,8 +72,8 @@ public function testGetSingleLocation()
7172 {
7273 $ location = factory (Location::class)->create ();
7374
74- $ response = $ this ->json ( ' GET ' , '/api/application/locations/ ' . $ location ->id );
75- $ response ->assertStatus (200 );
75+ $ response = $ this ->getJson ( '/api/application/locations/ ' . $ location ->id );
76+ $ response ->assertStatus (Response:: HTTP_OK );
7677 $ response ->assertJsonCount (2 );
7778 $ response ->assertJsonStructure (['object ' , 'attributes ' => ['id ' , 'short ' , 'long ' , 'created_at ' , 'updated_at ' ]]);
7879 $ response ->assertJson ([
@@ -95,8 +96,8 @@ public function testRelationshipsCanBeLoaded()
9596 $ location = factory (Location::class)->create ();
9697 $ server = $ this ->createServerModel (['user_id ' => $ this ->getApiUser ()->id , 'location_id ' => $ location ->id ]);
9798
98- $ response = $ this ->json ( ' GET ' , '/api/application/locations/ ' . $ location ->id . '?include=servers,nodes ' );
99- $ response ->assertStatus (200 );
99+ $ response = $ this ->getJson ( '/api/application/locations/ ' . $ location ->id . '?include=servers,nodes ' );
100+ $ response ->assertStatus (Response:: HTTP_OK );
100101 $ response ->assertJsonCount (2 )->assertJsonCount (2 , 'attributes.relationships ' );
101102 $ response ->assertJsonStructure ([
102103 'attributes ' => [
@@ -145,8 +146,8 @@ public function testKeyWithoutPermissionCannotLoadRelationship()
145146 $ location = factory (Location::class)->create ();
146147 factory (Node::class)->create (['location_id ' => $ location ->id ]);
147148
148- $ response = $ this ->json ( ' GET ' , '/api/application/locations/ ' . $ location ->id . '?include=nodes ' );
149- $ response ->assertStatus (200 );
149+ $ response = $ this ->getJson ( '/api/application/locations/ ' . $ location ->id . '?include=nodes ' );
150+ $ response ->assertStatus (Response:: HTTP_OK );
150151 $ response ->assertJsonCount (2 )->assertJsonCount (1 , 'attributes.relationships ' );
151152 $ response ->assertJsonStructure ([
152153 'attributes ' => [
@@ -176,7 +177,7 @@ public function testKeyWithoutPermissionCannotLoadRelationship()
176177 */
177178 public function testGetMissingLocation ()
178179 {
179- $ response = $ this ->json ( ' GET ' , '/api/application/locations/nil ' );
180+ $ response = $ this ->getJson ( '/api/application/locations/nil ' );
180181 $ this ->assertNotFoundJson ($ response );
181182 }
182183
@@ -189,7 +190,7 @@ public function testErrorReturnedIfNoPermission()
189190 $ location = factory (Location::class)->create ();
190191 $ this ->createNewDefaultApiKey ($ this ->getApiUser (), ['r_locations ' => 0 ]);
191192
192- $ response = $ this ->json ( ' GET ' , '/api/application/locations/ ' . $ location ->id );
193+ $ response = $ this ->getJson ( '/api/application/locations/ ' . $ location ->id );
193194 $ this ->assertAccessDeniedJson ($ response );
194195 }
195196
@@ -201,7 +202,7 @@ public function testResourceIsNotExposedWithoutPermissions()
201202 {
202203 $ this ->createNewDefaultApiKey ($ this ->getApiUser (), ['r_locations ' => 0 ]);
203204
204- $ response = $ this ->json ( ' GET ' , '/api/application/locations/nil ' );
205+ $ response = $ this ->getJson ( '/api/application/locations/nil ' );
205206 $ this ->assertAccessDeniedJson ($ response );
206207 }
207208}
0 commit comments