@@ -0,0 +1,1839 @@
+%22%22%22Tests for the 'web' plugin%22%22%22%0A%0Afrom _common import unittest%0Aimport _common%0Aimport json%0Aimport beets%0Aimport beetsplug%0Abeetsplug.__path__ = %5B'./beetsplug', '../beetsplug'%5D%0Afrom beetsplug import web%0A%0A%0Aclass WebPluginTest(_common.LibTestCase):%0A%0A    def setUp(self):%0A        super(WebPluginTest, self).setUp()%0A%0A        # Add fixtures%0A        self.lib.add(beets.library.Item(%0A            title =            u'another title',%0A            path =             'somepath' + str(_common._item_ident)))%0A        self.lib.add(beets.library.Album())%0A        self.lib.add(beets.library.Album())%0A%0A        web.app.config%5B'TESTING'%5D = True%0A        web.app.config%5B'lib'%5D = self.lib%0A        self.client = web.app.test_client()%0A%0A    def test_get_item(self):%0A        response = self.client.get('/item/')%0A        response.json = json.loads(response.data)%0A%0A        self.assertEqual(response.status_code, 200)%0A        self.assertEqual(len(response.json%5B'items'%5D), 2)%0A%0A    def test_get_item_empty_query(self):%0A        response = self.client.get('/item/query/')%0A        response.json = json.loads(response.data)%0A%0A        self.assertEqual(response.status_code, 200)%0A        self.assertEqual(len(response.json%5B'items'%5D), 2)%0A%0A    def test_get_album(self):%0A        response = self.client.get('/album/')%0A        response.json = json.loads(response.data)%0A%0A        self.assertEqual(response.status_code, 200)%0A        self.assertEqual(len(response.json%5B'albums'%5D), 2)%0A%0A    def test_get_album_empty_query(self):%0A        response = self.client.get('/album/query/')%0A        response.json = json.loads(response.data)%0A%0A        self.assertEqual(response.status_code, 200)%0A        self.assertEqual(len(response.json%5B'albums'%5D), 2)%0A%0A    %0A%0A%0Adef suite():%0A    return unittest.TestLoader().loadTestsFromName(__name__)%0A%0Aif __name__ == '__main__':%0A    unittest.main(defaultTest='suite')%0A

Add JSON-API tests