def testOptionalsShouldNotRaise(self): for field in ["state"]: f = self.f_postal_address.copy() f[field] = "" pa = PostalAddress(**f) # Should not raise here pa.full_clean()
def testBlanksMustRaise(self): for field in ["address", "city", "zip_code", "country"]: f = self.f_postal_address.copy() f[field] = "" pa = PostalAddress(**f) with self.assertRaises(ValidationError) as cm: pa.full_clean() err = cm.exception self.assertIn(_(u"This field cannot be blank"), err.messages[0])
def test_seller(self): postal_address = PostalAddress(street_address="123 Carrot down road", locality="Warszawa", region="Mazowieckie", postal_code="01-222", country="Poland") nip = "111" #nip = "111" seller = Seller(company_name="AtomicSolutions", postal_address=postal_address, NIP=nip, account_number="4435 4444 1111 0000 9999", bank_name="Macros") print(seller)
def testCountry(self): pa = PostalAddress(**self.f_postal_address) pa.full_clean() self.assertEqual(pa.country.name, _(u"Hungary"))
def testGoodCase(self): # Good case, must not raise pa = PostalAddress(**self.f_postal_address) pa.full_clean()