예제 #1
0
 def test_widget_valid_data(self):
     form = NewsItemAddForm(self.news,
         TestRequest(form={'addform.field.subjects': 'comics|books'}))
     form.update()
     data, errors = form.extractData()
     self.assertEqual(set(['comics', 'books']), data['subjects'])
     self.assertEqual(None, errors.get('addform.field.subjects', None))
예제 #2
0
 def test_widget_empty(self):
     form = NewsItemAddForm(self.news, TestRequest())
     form.update()
     data, errors = form.extractData()
     self.assertEqual(silvaforms.NO_VALUE, data['subjects'])
     self.assertEqual('Missing required value.',
         errors['addform.field.subjects'].title)