def test_model_with_sane_values(self): somefee = PricedItemFactory() self.assertEqual(somefee.fee_value, 4.5) self.assertEqual(somefee.notes, u'Wibble') self.assertEqual(somefee.currency, PricedItem.USD) self.assertEqual(somefee.tax_rate, 0.2) self.assertTrue(somefee.pk) somefee.clean()
def test_bogus_currency_raises_exceptions(self): somefee = PricedItemFactory() with self.assertRaises(ValidationError): somefee.currency = 'potatoes' somefee.full_clean()
def test_out_of_bounds_tax_rate_raises_exceptions(self): somefee = PricedItemFactory() with self.assertRaises(ValidationError): somefee.tax_rate = -0.3 somefee.full_clean()