Return Http test cases to a passing state
This commit is contained in:
parent
eaae74fe33
commit
536180ed0c
26 changed files with 140 additions and 1113 deletions
|
@ -9,6 +9,8 @@ use Illuminate\Contracts\Routing\ResponseFactory;
|
|||
use Tests\Unit\Http\Middleware\MiddlewareTestCase;
|
||||
use Pterodactyl\Http\Middleware\Server\AccessingValidServer;
|
||||
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
|
||||
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
|
||||
class AccessingValidServerTest extends MiddlewareTestCase
|
||||
{
|
||||
|
@ -41,12 +43,12 @@ class AccessingValidServerTest extends MiddlewareTestCase
|
|||
|
||||
/**
|
||||
* Test that an exception is thrown if the request is an API request and the server is suspended.
|
||||
*
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
|
||||
* @expectedExceptionMessage Server is suspended and cannot be accessed.
|
||||
*/
|
||||
public function testExceptionIsThrownIfServerIsSuspended()
|
||||
{
|
||||
$this->expectException(AccessDeniedHttpException::class);
|
||||
$this->expectExceptionMessage('Server is suspended and cannot be accessed.');
|
||||
|
||||
$model = factory(Server::class)->make(['suspended' => 1]);
|
||||
|
||||
$this->request->shouldReceive('route->parameter')->with('server')->once()->andReturn('123456');
|
||||
|
@ -59,12 +61,12 @@ class AccessingValidServerTest extends MiddlewareTestCase
|
|||
|
||||
/**
|
||||
* Test that an exception is thrown if the request is an API request and the server is not installed.
|
||||
*
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\ConflictHttpException
|
||||
* @expectedExceptionMessage Server is still completing the installation process.
|
||||
*/
|
||||
public function testExceptionIsThrownIfServerIsNotInstalled()
|
||||
{
|
||||
$this->expectException(ConflictHttpException::class);
|
||||
$this->expectExceptionMessage('Server is still completing the installation process.');
|
||||
|
||||
$model = factory(Server::class)->make(['installed' => 0]);
|
||||
|
||||
$this->request->shouldReceive('route->parameter')->with('server')->once()->andReturn('123456');
|
||||
|
|
Reference in a new issue