def test_should_save_yesno_poll_with_default_yesno_categories(self):
        self.poll['ptype'] = 'yesno'
        poll = Poll(**self.poll).save()

        self.assertEqual(1, Poll.objects.count())
        self.assertEqual(True, poll.is_yesno_poll())

        yes_category = ResponseCategory.objects(**dict(poll=poll, name='yes')).first()
        no_category = ResponseCategory.objects(**dict(poll=poll, name='no')).first()
        self.assertEqual(2, Rule.objects.count())
        self.assertEqual(u'someYES|Yeahregex', Rule.objects(**dict(response_category=yes_category)).first().regex)
        self.assertEqual(u'someNo|NAhregex', Rule.objects(**dict(response_category=no_category)).first().regex)
Beispiel #2
0
 def rules(self):
     return Rule.objects(response_category=self)
Beispiel #3
0
 def rules(self):
     return Rule.objects(response_category=self)