Changeset 7440 for main/waeup.sirp/trunk


Ignore:
Timestamp:
23 Dec 2011, 10:51:04 (13 years ago)
Author:
uli
Message:

Update tests.

File:
1 edited

Legend:

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

    r7435 r7440  
    4848        title = u'Phone',
    4949        description = u'Phone number (not required)',
    50         required = False)
     50        required = False,)
     51
     52    baz = schema.TextLine(
     53        title = u'Phone',
     54        description = u'Required phone with a default',
     55        required = True,
     56        default=u'234--')
    5157
    5258class SampleContent:
     
    7480        self.field_nonreq = ISampleContent['bar']
    7581        self.field_nonreq = self.field_nonreq.bind(self.content)
     82        self.field_w_default = ISampleContent['baz']
     83        self.field_w_default = self.field_w_default.bind(self.content)
    7684
    7785        # create an empty request. We need one to create a widget
     
    186194                'field.foo.country': 'not-a-number',
    187195                'field.foo.area': '456',
    188                 'field.foo.extension': '12345'
     196                'field.foo.extension': '12345',
    189197                })
    190198        widget = PhoneWidget(self.field, request)
     
    458466        content = Content()
    459467        request = TestRequest(form={
    460                 'field.foo.country': '11',
    461                 'field.foo.area': '222',
    462                 'field.foo.extension': '3333'})
     468                'field.bar.country': '',
     469                'field.bar.area': '',
     470                'field.bar.extension': '',
     471                })
    463472        widget = PhoneWidget(self.field_nonreq, request)
    464473        result1 = widget.applyChanges(content)
    465474        result2 = widget.getInputValue()
    466475        self.assertEqual(result1, True)
    467         # without input we get the default value set
    468         self.assertEqual(content.bar, u'')
    469         self.assertEqual(result2, u'')
     476        # without input we get None
     477        self.assertTrue(content.bar is None)
     478        self.assertTrue(result2 is None)
    470479        return
    471480
Note: See TracChangeset for help on using the changeset viewer.