- 'Added tag not in tag_changes.added')
-
- # test changed tag in changed
- self.tag.slug = 'a-tag'
- self.tag.save()
- changes = json.loads(self.client.get('/api/tag_changes/%f.json' % timestamp(self.tag.created_at)).content)
- self.assertEqual(changes['added'],
- [],
- 'Changed tag in tag_changes.added instead of tag_changes.changed.')
- self.assertEqual(len(changes['changed']),
- 1,
- 'Changed tag not in tag_changes.changed.')
-
- # test deleted book in deleted
- Tag.objects.all().delete()
- changes = json.loads(self.client.get('/api/tag_changes/%f.json' % timestamp(self.tag.changed_at)).content)
- self.assertEqual(changes['added'],
- [],
- 'Deleted tag still in tag_changes.added.')
- self.assertEqual(changes['changed'],
- [],
- 'Deleted tag still in tag_changes.changed.')
- self.assertEqual(len(changes['deleted']),
- 1,
- 'Deleted tag not in tag_changes.deleted.')
+ 'Added tag not in tag_changes.updated')
+
+ def test_empty_disappears(self):
+ self.book.tags = []
+ self.book.save()
+ changes = json.loads(self.client.get('/api/tag_changes/0.json').content)
+ self.assertEqual(len(changes), 1,
+ 'Empty or deleted tag should disappear.')