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_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))
def test_validate_one_option(self): data = MockPoll() data.options = [{'option_id': 0, 'description': 'Foo'}] with self.assertRaises(InsuficientOptions): IPoll.validateInvariants(data)
def test_validate_no_options(self): data = MockPoll() with self.assertRaises(InsuficientOptions): IPoll.validateInvariants(data)
def test_adding(self): self.assertTrue(IPoll.providedBy(self.poll))