Merge pull request #2325 from wallabag/api-entries-exists

Add an exists endpoint in API
This commit is contained in:
Nicolas Lœuillet
2016-10-02 13:17:23 +02:00
committed by GitHub
2 changed files with 54 additions and 0 deletions

View File

@ -684,4 +684,26 @@ class WallabagRestControllerTest extends WallabagApiTestCase
$this->assertEquals(true, $content['is_starred']);
}
public function testGetEntriesExists()
{
$this->client->request('GET', '/api/entries/exists?url=http://0.0.0.0/entry2');
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
$content = json_decode($this->client->getResponse()->getContent(), true);
$this->assertEquals(true, $content['exists']);
}
public function testGetEntriesExistsWhichDoesNotExists()
{
$this->client->request('GET', '/api/entries/exists?url=http://google.com/entry2');
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
$content = json_decode($this->client->getResponse()->getContent(), true);
$this->assertEquals(false, $content['exists']);
}
}