def test_salesTax(self): addr = Contact() addr.stateCD = 'NY' addr.postal = '123456' actual = self.store.calcSalesTax(addr, 10) assert actual == 0, \ "shouldn't have sales tax because no nexus in NY" addr = Contact() addr.stateCD = 'CA' actual = self.store.calcSalesTax(addr, 10) goal = (FixedPoint(clerk.match(State, CD="CA")[0].salestax) * 10) / 100.0 assert actual == goal, \ "wrong sales tax after nexus established: %s vs %s" \ % (actual, goal)
def test_email(self): ctact = Contact() try: ctact.email = "@sadf@@" gotError = 0 except TypeError: gotError = 1 assert gotError, "didn't get error assigning invalid email." ctact.email = "*****@*****.**" self.assertEquals(ctact.email, "*****@*****.**")
def check_email(self): ctact = Contact(zikeshop.test.dbc) try: ctact.email = "@sadf@@" gotError = 0 except ValueError: gotError = 1 assert gotError, "didn't get error assigning invalid email." ctact.email = "*****@*****.**" assert ctact.email=="*****@*****.**", \ "setting the email didn't work!"