221 |
221 |
222 def test_interval_bound_constraint_success(self): |
222 def test_interval_bound_constraint_success(self): |
223 feid = self.execute('INSERT File X: X data_name "toto.txt", X data %(data)s', |
223 feid = self.execute('INSERT File X: X data_name "toto.txt", X data %(data)s', |
224 {'data': Binary('yo')})[0][0] |
224 {'data': Binary('yo')})[0][0] |
225 self.commit() |
225 self.commit() |
226 req = self.request() |
226 req = self.request(rollbackfirst=True) |
227 req.form = {'eid': ['X'], |
227 req.form = {'eid': ['X'], |
228 '__type:X': 'Salesterm', |
228 '__type:X': 'Salesterm', |
229 '_cw_edited_fields:X': 'amount-subject,described_by_test-subject', |
229 '_cw_edited_fields:X': 'amount-subject,described_by_test-subject', |
230 'amount-subject:X': u'-10', |
230 'amount-subject:X': u'-10', |
231 'described_by_test-subject:X': u(feid), |
231 'described_by_test-subject:X': u(feid), |
232 } |
232 } |
233 ex = self.assertRaises(ValidationError, self.ctrl_publish, req) |
233 ex = self.assertRaises(ValidationError, self.ctrl_publish, req) |
234 self.assertEqual(ex.errors, {'amount-subject': 'value must be >= 0'}) |
234 self.assertEqual(ex.errors, {'amount-subject': 'value must be >= 0'}) |
235 req = self.request() |
235 req = self.request(rollbackfirst=True) |
236 req.form = {'eid': ['X'], |
236 req.form = {'eid': ['X'], |
237 '__type:X': 'Salesterm', |
237 '__type:X': 'Salesterm', |
238 '_cw_edited_fields:X': 'amount-subject,described_by_test-subject', |
238 '_cw_edited_fields:X': 'amount-subject,described_by_test-subject', |
239 'amount-subject:X': u'110', |
239 'amount-subject:X': u'110', |
240 'described_by_test-subject:X': u(feid), |
240 'described_by_test-subject:X': u(feid), |
241 } |
241 } |
242 ex = self.assertRaises(ValidationError, self.ctrl_publish, req) |
242 ex = self.assertRaises(ValidationError, self.ctrl_publish, req) |
243 self.assertEqual(ex.errors, {'amount-subject': 'value must be <= 100'}) |
243 self.assertEqual(ex.errors, {'amount-subject': 'value must be <= 100'}) |
244 req = self.request() |
244 req = self.request(rollbackfirst=True) |
245 req.form = {'eid': ['X'], |
245 req.form = {'eid': ['X'], |
246 '__type:X': 'Salesterm', |
246 '__type:X': 'Salesterm', |
247 '_cw_edited_fields:X': 'amount-subject,described_by_test-subject', |
247 '_cw_edited_fields:X': 'amount-subject,described_by_test-subject', |
248 'amount-subject:X': u'10', |
248 'amount-subject:X': u'10', |
249 'described_by_test-subject:X': u(feid), |
249 'described_by_test-subject:X': u(feid), |