add test for access without authentication

This commit is contained in:
korelstar 2021-08-07 11:43:47 +02:00
parent feefd68fd1
commit 2c4b20fecc
1 changed files with 6 additions and 1 deletions

View File

@ -266,7 +266,12 @@ abstract class CommonAPITest extends AbstractAPITest {
$this->assertEquals(507, $response2->getStatusCode());
}
public function testUnauthorized() {
public function testNotAuthenticated() {
$response = $this->http->request('GET', 'notes', [ 'auth' => null ]);
$this->checkResponse($response, 'Get existing notes', 401);
}
public function testWrongCredentials() {
$auth = ['test', 'wrongpassword'];
$response = $this->http->request('GET', 'notes', [ 'auth' => $auth ]);
$this->checkResponse($response, 'Get existing notes', 401);