mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 23:54:44 +02:00
Fix test cases
This commit is contained in:
parent
df64026449
commit
2f2d105a4f
@ -26,7 +26,7 @@ class AuthenticateIPAccessTest extends MiddlewareTestCase
|
|||||||
*/
|
*/
|
||||||
public function testWithValidIP()
|
public function testWithValidIP()
|
||||||
{
|
{
|
||||||
$model = factory(ApiKey::class)->make(['allowed_ips' => '["127.0.0.1"]']);
|
$model = factory(ApiKey::class)->make(['allowed_ips' => ['127.0.0.1']]);
|
||||||
$this->setRequestAttribute('api_key', $model);
|
$this->setRequestAttribute('api_key', $model);
|
||||||
|
|
||||||
$this->request->shouldReceive('ip')->withNoArgs()->once()->andReturn('127.0.0.1');
|
$this->request->shouldReceive('ip')->withNoArgs()->once()->andReturn('127.0.0.1');
|
||||||
@ -39,7 +39,7 @@ class AuthenticateIPAccessTest extends MiddlewareTestCase
|
|||||||
*/
|
*/
|
||||||
public function testValidIPAgainstCIDRRange()
|
public function testValidIPAgainstCIDRRange()
|
||||||
{
|
{
|
||||||
$model = factory(ApiKey::class)->make(['allowed_ips' => '["192.168.1.1/28"]']);
|
$model = factory(ApiKey::class)->make(['allowed_ips' => ['192.168.1.1/28']]);
|
||||||
$this->setRequestAttribute('api_key', $model);
|
$this->setRequestAttribute('api_key', $model);
|
||||||
|
|
||||||
$this->request->shouldReceive('ip')->withNoArgs()->once()->andReturn('192.168.1.15');
|
$this->request->shouldReceive('ip')->withNoArgs()->once()->andReturn('192.168.1.15');
|
||||||
@ -55,7 +55,7 @@ class AuthenticateIPAccessTest extends MiddlewareTestCase
|
|||||||
{
|
{
|
||||||
$this->expectException(AccessDeniedHttpException::class);
|
$this->expectException(AccessDeniedHttpException::class);
|
||||||
|
|
||||||
$model = factory(ApiKey::class)->make(['allowed_ips' => '["127.0.0.1"]']);
|
$model = factory(ApiKey::class)->make(['allowed_ips' => ['127.0.0.1']]);
|
||||||
$this->setRequestAttribute('api_key', $model);
|
$this->setRequestAttribute('api_key', $model);
|
||||||
|
|
||||||
$this->request->shouldReceive('ip')->withNoArgs()->twice()->andReturn('127.0.0.2');
|
$this->request->shouldReceive('ip')->withNoArgs()->twice()->andReturn('127.0.0.2');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user