コード例 #1
0
ファイル: tests.py プロジェクト: Daphna-Shalev/Open-Knesset
 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])
コード例 #2
0
ファイル: tests.py プロジェクト: Daphna-Shalev/Open-Knesset
 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())