Ignore:
Timestamp:
12 Mar 2012, 16:19:40 (13 years ago)
Author:
uli
Message:

Fix tests to reflect really expected behaviour with missing_values.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/widgets/tests/test_phonewidget.py

    r7840 r7849  
    4444        title = u'Phone',
    4545        description = u'Phone number',
    46         required = True)
     46        required = True,
     47        default=u'+234-1-1')
    4748
    4849    bar = schema.TextLine(
     
    5556        title = u'Phone',
    5657        description = u'Required phone with a default',
    57         required = True,
    58         #default=u'234--'
     58        required = False,
     59        #default=u'+234--'
    5960        )
    6061
     
    6263    implements(ISampleContent)
    6364
    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
    6769
    6870class PhoneWidgetTests(unittest.TestCase):
     
    529531    widgets = [
    530532        (ITextLine, TextWidget),
     533        (ITextLine, TextWidget),
     534        (ITextLine, TextWidget),
    531535        ]
    532536
    533537    def setUp(self):
    534538        super(PhoneWidget2Tests, self).setUp()
     539        # register the phone prefixes utility
    535540        self.gsm = getGlobalSiteManager()
    536541        self.reg_prefixes = PhonePrefixes()
     
    561566
    562567        # submit edit view
    563         request.form['form.foo.country'] = u'123'
     568        request.form['form.foo.country'] = u'+123'
    564569        request.form['form.foo.area'] = u'456'
    565570        request.form['form.foo.ext'] = u'7890'
     
    568573
    569574        # check new values in object
    570         self.assertEqual(content.foo, u'123-456-7890')
     575        self.assertEqual(content.foo, u'+123-456-7890')
    571576        return
    572577
     
    577582
    578583        # submit invalid type for text line
    579         request.form['form.foo.country'] = '123'
     584        request.form['form.foo.country'] = '+123'
    580585        request.form['form.foo.area'] = '456'
    581586        request.form['form.foo.ext'] = '7890'
     
    592597        request = TestRequest()
    593598
    594         request.form['form.foo.country'] = u'123'
     599        request.form['form.foo.country'] = u'+123'
    595600        request.form['form.foo.area'] = u'456'
    596601        request.form['form.foo.ext'] = u'7890'
     
    602607        request.form['form.baz.ext'] = u''
    603608        request.form['form.actions.apply'] = u''
     609
    604610        SampleForm(content, request)()
    605611
    606612        # check new values in object
    607         self.assertEqual(content.foo, u'123-456-7890')
    608         self.assertEqual(content.bar, u'--') # default missing value
    609         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.