Update tests

This commit is contained in:
Jeremy Benoist 2022-04-20 22:14:56 +02:00
parent 33b1c252a7
commit a885f5043a
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C

View file

@ -11,17 +11,19 @@ class ConfigRestControllerTest extends WallabagApiTestCase
$this->client->request('GET', '/api/config.json');
$this->assertSame(200, $this->client->getResponse()->getStatusCode());
$content = json_decode($this->client->getResponse()->getContent(), true);
$config = json_decode($this->client->getResponse()->getContent(), true);
$this->assertArrayHasKey('id', $content);
$this->assertArrayHasKey('items_per_page', $content);
$this->assertArrayHasKey('language', $content);
$this->assertArrayHasKey('reading_speed', $content);
$this->assertArrayHasKey('action_mark_as_read', $content);
$this->assertArrayHasKey('list_mode', $content);
$this->assertArrayHasKey('id', $config);
$this->assertArrayHasKey('items_per_page', $config);
$this->assertArrayHasKey('language', $config);
$this->assertArrayHasKey('reading_speed', $config);
$this->assertArrayHasKey('action_mark_as_read', $config);
$this->assertArrayHasKey('list_mode', $config);
$this->assertSame(200.0, $content['reading_speed']);
$this->assertSame('en', $content['language']);
$this->assertSame(200.0, $config['reading_speed']);
$this->assertSame('en', $config['language']);
$this->assertCount(6, $config);
$this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
}
@ -32,12 +34,12 @@ class ConfigRestControllerTest extends WallabagApiTestCase
$client->request('GET', '/api/config.json');
$this->assertSame(401, $client->getResponse()->getStatusCode());
$content = json_decode($client->getResponse()->getContent(), true);
$config = json_decode($client->getResponse()->getContent(), true);
$this->assertArrayHasKey('error', $content);
$this->assertArrayHasKey('error_description', $content);
$this->assertArrayHasKey('error', $config);
$this->assertArrayHasKey('error_description', $config);
$this->assertSame('access_denied', $content['error']);
$this->assertSame('access_denied', $config['error']);
$this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type'));
}