def test_approve_existing_tag(self): Tag.objects.create(name='suggestion 2') tag_suggestion = TagSuggestion.objects.create( name='suggestion 2', suggested_by=self.user, object=self.bill ) approve(None, None, [tag_suggestion])
def test_approve(self): tag_suggestion = TagSuggestion.objects.create( name='suggestion 1', suggested_by=self.user, object=self.bill ) approve(None, None, [tag_suggestion]) tag = Tag.objects.get(name=tag_suggestion.name) self.assertEqual(tag.name, tag_suggestion.name) tagged_item = tag.items.all()[0] self.assertEqual(tagged_item.object, self.bill) # after a successful approval the tag suggestion should be deleted self.assertEqual(0, TagSuggestion.objects.filter(name='suggestion 1').count())