示例#1
0
 def test_validate_two_options(self):
     data = MockPoll()
     data.options = [{'option_id': 0, 'description': 'Foo'},
                     {'option_id': 1, 'description': 'Bar'},
                    ]
     try:
         IPoll.validateInvariants(data)
     except InsuficientOptions:
         self.fail()
示例#2
0
 def test_validate_two_options(self):
     data = MockPoll()
     data.options = [
         {
             'option_id': 0,
             'description': 'Foo'
         },
         {
             'option_id': 1,
             'description': 'Bar'
         },
     ]
     try:
         IPoll.validateInvariants(data)
     except InsuficientOptions:
         self.fail()
 def test_factory(self):
     fti = queryUtility(IDexterityFTI, name='collective.polls.poll')
     factory = fti.factory
     new_object = createObject(factory)
     self.assertTrue(IPoll.providedBy(new_object))
 def test_adding(self):
     self.folder.invokeFactory('collective.polls.poll', 'p1')
     p1 = self.folder['p1']
     self.assertTrue(IPoll.providedBy(p1))
示例#5
0
    def test_validate_one_option(self):
        data = MockPoll()
        data.options = [{'option_id': 0, 'description': 'Foo'}]

        with self.assertRaises(InsuficientOptions):
            IPoll.validateInvariants(data)
示例#6
0
    def test_validate_no_options(self):
        data = MockPoll()

        with self.assertRaises(InsuficientOptions):
            IPoll.validateInvariants(data)
示例#7
0
 def test_factory(self):
     fti = queryUtility(IDexterityFTI, name='collective.polls.poll')
     factory = fti.factory
     new_object = createObject(factory)
     self.assertTrue(IPoll.providedBy(new_object))
示例#8
0
 def test_adding(self):
     self.assertTrue(IPoll.providedBy(self.poll))
示例#9
0
    def test_validate_one_option(self):
        data = MockPoll()
        data.options = [{'option_id': 0, 'description': 'Foo'}]

        with self.assertRaises(InsuficientOptions):
            IPoll.validateInvariants(data)
示例#10
0
    def test_validate_no_options(self):
        data = MockPoll()

        with self.assertRaises(InsuficientOptions):
            IPoll.validateInvariants(data)
示例#11
0
 def test_adding(self):
     self.assertTrue(IPoll.providedBy(self.poll))
示例#12
0
 def test_adding(self):
     self.folder.invokeFactory('collective.polls.poll', 'p1')
     p1 = self.folder['p1']
     self.assertTrue(IPoll.providedBy(p1))