- Timestamp:
- 6 Aug 2010, 09:30:25 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.widgets.core/trunk/src/waeup/widgets/core/tests/test_dictwidget.py
r5377 r5378 493 493 assert widget._getRenderedValue() == {u'somekey': u'somevalue'} 494 494 495 def test_broken_subwidget(self): 496 self.field = Dict(__name__=u'foo', 497 key_type=TextLine(__name__=u'bar'), 498 value_type=TextLine(__name__=u'baz'), 499 ) 500 request = TestRequest(form={'field.foo.key.0.bar': u'Hello', 501 'field.foo.value.0.baz': u'world!', 502 'field.foo.count': u'1'}) 503 btw = CustomWidgetFactory(BrokenTextWidget) 504 505 # Broken key_subwidget... 506 widget = DictWidget( 507 self.field, request, key_subwidget=btw) 508 self.assertRaises(WidgetInputError, widget.getInputValue) 509 assert widget._error is not None 510 assert widget._error.errors == 'Intended Exception' 511 512 # Broken value_subwidget... 513 widget = DictWidget( 514 self.field, request, value_subwidget=btw) 515 self.assertRaises(WidgetInputError, widget.getInputValue) 516 assert widget._error is not None 517 assert widget._error.errors == 'Intended Exception' 518 519 495 520 class DictDisplayWidgetTest( 496 521 VerifyResults, DictWidgetTestHelper, unittest.TestCase): … … 578 603 return super(UppercaseDisplayWidget, self).__call__().upper() 579 604 605 class BrokenTextWidget(TextWidget): 606 """A text widget that tells, that everything is okay even if it is not. 607 """ 608 def hasValidInput(self): 609 return True 610 def getInputValue(self): 611 """Raise input error intentionally. 612 """ 613 raise WidgetInputError( 614 self.context.__name__, self.context.title, 'Intended Exception') 580 615 581 616 def setUp(test):
Note: See TracChangeset for help on using the changeset viewer.