Пример #1
0
 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()
Пример #2
0
 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()
Пример #3
0
 def test_bogus_currency_raises_exceptions(self):
     somefee = PricedItemFactory()
     with self.assertRaises(ValidationError):
         somefee.currency = 'potatoes'
         somefee.full_clean()
Пример #4
0
 def test_out_of_bounds_tax_rate_raises_exceptions(self):
     somefee = PricedItemFactory()
     with self.assertRaises(ValidationError):
         somefee.tax_rate = -0.3
         somefee.full_clean()
Пример #5
0
 def test_bogus_currency_raises_exceptions(self):
     somefee = PricedItemFactory()
     with self.assertRaises(ValidationError):
         somefee.currency = 'potatoes'
         somefee.full_clean()
Пример #6
0
 def test_out_of_bounds_tax_rate_raises_exceptions(self):
     somefee = PricedItemFactory()
     with self.assertRaises(ValidationError):
         somefee.tax_rate = -0.3
         somefee.full_clean()