Changeset 7849 for main/waeup.kofa/trunk/src/waeup/kofa/widgets/tests
- Timestamp:
- 12 Mar 2012, 16:19:40 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/widgets/tests/test_phonewidget.py
r7840 r7849 44 44 title = u'Phone', 45 45 description = u'Phone number', 46 required = True) 46 required = True, 47 default=u'+234-1-1') 47 48 48 49 bar = schema.TextLine( … … 55 56 title = u'Phone', 56 57 description = u'Required phone with a default', 57 required = True,58 #default=u' 234--'58 required = False, 59 #default=u'+234--' 59 60 ) 60 61 … … 62 63 implements(ISampleContent) 63 64 64 foo = None 65 bar = 'bar' 66 baz = None 65 def __init__(self): 66 self.foo = None 67 self.bar = 'bar' 68 self.baz = None 67 69 68 70 class PhoneWidgetTests(unittest.TestCase): … … 529 531 widgets = [ 530 532 (ITextLine, TextWidget), 533 (ITextLine, TextWidget), 534 (ITextLine, TextWidget), 531 535 ] 532 536 533 537 def setUp(self): 534 538 super(PhoneWidget2Tests, self).setUp() 539 # register the phone prefixes utility 535 540 self.gsm = getGlobalSiteManager() 536 541 self.reg_prefixes = PhonePrefixes() … … 561 566 562 567 # submit edit view 563 request.form['form.foo.country'] = u' 123'568 request.form['form.foo.country'] = u'+123' 564 569 request.form['form.foo.area'] = u'456' 565 570 request.form['form.foo.ext'] = u'7890' … … 568 573 569 574 # check new values in object 570 self.assertEqual(content.foo, u' 123-456-7890')575 self.assertEqual(content.foo, u'+123-456-7890') 571 576 return 572 577 … … 577 582 578 583 # submit invalid type for text line 579 request.form['form.foo.country'] = ' 123'584 request.form['form.foo.country'] = '+123' 580 585 request.form['form.foo.area'] = '456' 581 586 request.form['form.foo.ext'] = '7890' … … 592 597 request = TestRequest() 593 598 594 request.form['form.foo.country'] = u' 123'599 request.form['form.foo.country'] = u'+123' 595 600 request.form['form.foo.area'] = u'456' 596 601 request.form['form.foo.ext'] = u'7890' … … 602 607 request.form['form.baz.ext'] = u'' 603 608 request.form['form.actions.apply'] = u'' 609 604 610 SampleForm(content, request)() 605 611 606 612 # check new values in object 607 self.assertEqual(content.foo, u' 123-456-7890')608 self.assertEqual(content.bar, u' --') # default missing value609 self.assertEqual(content.baz, u'--')610 return 613 self.assertEqual(content.foo, u'+123-456-7890') 614 self.assertEqual(content.bar, u'') # default missing value 615 self.assertEqual(content.baz, None) 616 return
Note: See TracChangeset for help on using the changeset viewer.