1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-10-15 19:42:08 +00:00

GET /api/tags/id_tag method

This commit is contained in:
Nicolas Lœuillet 2015-02-20 16:38:24 +01:00
parent 1d14779154
commit 2691cf0438
4 changed files with 86 additions and 4 deletions

View file

@ -150,4 +150,33 @@ class WallabagRestControllerTest extends WallabagTestCase
$this->assertEquals(404, $client->getResponse()->getStatusCode());
}
public function testGetOneTag()
{
$client = $this->createClient();
$client->request('GET', '/api/salts/admin.json');
$salt = json_decode($client->getResponse()->getContent());
$headers = $this->generateHeaders('admin', 'test', $salt[0]);
$tag = $client->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('WallabagCoreBundle:Tag')
->findOneByLabel('foo');
if (!$tag) {
$this->markTestSkipped('No content found in db.');
}
$client->request('GET', '/api/tags/'.$tag->getLabel().'.json', array(), array(), $headers);
$this->assertEquals(json_encode($tag), $client->getResponse()->getContent());
$this->assertTrue(
$client->getResponse()->headers->contains(
'Content-Type',
'application/json'
)
);
}
}