- # test changed book in changed
- self.book.slug = 'a-book'
- self.book.save()
- changes = json.loads(self.client.get('/api/book_changes/%f.json' % timestamp(self.book.created_at)).content)
- self.assertEqual(changes['added'],
- [],
- 'Changed book in book_changes.added instead of book_changes.changed.')
- self.assertEqual(len(changes['changed']),
- 1,
- 'Changed book not in book_changes.changed.')
-
- # test deleted book in deleted
- Book.objects.all().delete()
- changes = json.loads(self.client.get('/api/book_changes/%f.json' % timestamp(self.book.changed_at)).content)
- self.assertEqual(changes['added'],
- [],
- 'Deleted book still in book_changes.added.')
- self.assertEqual(changes['changed'],
- [],
- 'Deleted book still in book_changes.changed.')
- self.assertEqual(len(changes['deleted']),
- 1,
- 'Deleted book not in book_changes.deleted.')
-
- def test_shelf(self):
- changed_at = self.book.changed_at
- print changed_at
-
- # putting on a shelf should not update changed_at
- shelf = Tag.objects.create(category='set', slug='shelf')
- self.book.tags = [shelf]
- self.assertEqual(self.book.changed_at,
- changed_at)
-
-class TagChangesTests(TestCase):
+ def test_tag_detail(self):
+ tag = self.load_json('/api/authors/joe/')
+ self.assertEqual(tag['name'], self.tag.name,
+ 'Wrong tag details.')