1
0
Fork 0
mirror of https://codeberg.org/demostf/api.git synced 2026-06-03 09:54:17 +02:00

better status codes, again

This commit is contained in:
Robin Appelman 2020-11-25 23:26:54 +01:00
commit c7b637a05f
6 changed files with 78 additions and 7 deletions

View file

@ -8,6 +8,8 @@ use Demostf\API\Controllers\DemoController;
use Demostf\API\Demo\ChatMessage;
use Demostf\API\Demo\Demo;
use Demostf\API\Demo\DemoStore;
use Demostf\API\Error\InvalidHashException;
use Demostf\API\Error\InvalidKeyException;
use Demostf\API\Providers\ChatProvider;
use Demostf\API\Providers\DemoListProvider;
use Demostf\API\Providers\DemoProvider;
@ -90,7 +92,7 @@ class DemoControllerTest extends ControllerTest {
'key' => 'invalid',
]);
$this->expectException(InvalidArgumentException::class);
$this->expectException(InvalidKeyException::class);
$this->expectExceptionMessage('Invalid key');
$controller->setDemoUrl('1');
@ -105,7 +107,7 @@ class DemoControllerTest extends ControllerTest {
'key' => 'supersecretkey',
]);
$this->expectException(InvalidArgumentException::class);
$this->expectException(InvalidHashException::class);
$this->expectExceptionMessage('Invalid demo hash');
$demo = $this->createConfiguredMock(Demo::class, [

View file

@ -201,7 +201,7 @@ describe("Set url", function () {
}
});
expect(setUrl).to.be.containsText('Invalid key');
expect(setUrl).to.have.status(500);
expect(setUrl).to.have.status(401);
return chakram.wait();
});
});
@ -220,7 +220,7 @@ describe("Set url", function () {
}
});
expect(setUrl).to.be.containsText('Invalid demo hash');
expect(setUrl).to.have.status(500);
expect(setUrl).to.have.status(412);
return chakram.wait();
});
});