Exemple #1
0
 def test_setting_valid_uniqueId_returns_content_object(self):
     context = mock.Mock()
     context.__name__ = 'foo'
     source = [self.repository['testcontent']]
     widget = ObjectSequenceWidget(context, source, request=mock.Mock())
     self.assertEqual(
         (self.repository['testcontent'], ),
         widget._toFieldValue(['http://xml.zeit.de/testcontent']))
Exemple #2
0
 def test_invalid_unique_id_fails_validation(self):
     context = mock.Mock()
     context.__name__ = 'name'
     widget = ObjectSequenceWidget(context, mock.Mock(), mock.Mock())
     with self.assertRaises(zope.formlib.interfaces.ConversionError):
         widget._toFieldValue([mock.sentinel.foo, mock.sentinel.bar])