X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/1123ad09c5b6b23721639c9a1454fd80999759ee..5aa13410812d3fc4b35c039bdc3f0a2edc5185a1:/src/api/tests/tests.py?ds=sidebyside diff --git a/src/api/tests/tests.py b/src/api/tests/tests.py index adaaa6002..91e5bbf84 100644 --- a/src/api/tests/tests.py +++ b/src/api/tests/tests.py @@ -364,6 +364,15 @@ class AuthorizedTests(ApiTest): return json.loads(self.signed(url, method, params).content) def test_books(self): + self.assertEqual( + [b['liked'] for b in self.signed_json('/api/books/')], + [False, False, False] + ) + # This one fails in the legacy implementation + # data = self.signed_json('/api/books/child/') + # self.assertFalse(data['parent']['liked']) + # self.assertFalse(data['children'][0]['liked']) + self.assertEqual( self.signed_json('/api/like/parent/'), {"likes": False} @@ -377,6 +386,10 @@ class AuthorizedTests(ApiTest): self.assertTrue(self.signed_json('/api/parent_books/')[0]['liked']) self.assertTrue(self.signed_json( '/api/filter-books/', params={"search": "parent"})[0]['liked']) + + # This one fails in the legacy implementation. + #self.assertTrue(self.signed_json( + # '/api/books/child/')['parent']['liked']) # Liked books go on shelf. self.assertEqual( [x['slug'] for x in self.signed_json('/api/shelf/likes/')],