Example #1
0
 def setUp(self):
     self.store = Store(clerk)
     try:
         try:
             state = clerk.match(State, CD="CA")[0]
         except:
             state = State(CD="CA")
         state.salestax = FixedPoint("8.25")
         clerk.store(state)
     except:
         pass
Example #2
0
class StoreTestCase(unittest.TestCase):
    __ver__ = "$Id$"

    def setUp(self):
        self.store = Store(clerk)
        try:
            try:
                state = clerk.match(State, CD="CA")[0]
            except:
                state = State(CD="CA")
            state.salestax = FixedPoint("8.25")
            clerk.store(state)
        except:
            pass


    def check_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 check_products(self):
        import zikeshop.test
        cur = zikeshop.test.dbc.cursor()
        cur.execute("DELETE FROM shop_product")
        cur.execute("INSERT INTO shop_product (class, name)" 
                    "values ('product', 'asdfasf')")
        actual = len(self.store.products)
        assert actual==1, \
               "wrong # of products found: %s"  % actual
        

    def check_fakedata(self):
        import fakedata
        fakedata.load()
Example #3
0
class StoreTestCase(unittest.TestCase):
    __ver__ = "$Id$"

    def setUp(self):
        self.store = Store(clerk)
        try:
            try:
                state = clerk.match(State, CD="CA")[0]
            except:
                state = State(CD="CA")
            state.salestax = FixedPoint("8.25")
            clerk.store(state)
        except:
            pass

    def check_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 check_products(self):
        import zikeshop.test
        cur = zikeshop.test.dbc.cursor()
        cur.execute("DELETE FROM shop_product")
        cur.execute("INSERT INTO shop_product (class, name)"
                    "values ('product', 'asdfasf')")
        actual = len(self.store.products)
        assert actual==1, \
               "wrong # of products found: %s"  % actual

    def check_fakedata(self):
        import fakedata
        fakedata.load()
Example #4
0
 def setUp(self):
     self.store = Store(clerk)
     try:
         try:
             state = clerk.match(State, CD="CA")[0]
         except:
             state = State(CD="CA")
         state.salestax = FixedPoint("8.25")
         clerk.store(state)
     except:
         pass
Example #5
0
class StoreTest(unittest.TestCase):
    __ver__ = "$Id$"

    def setUp(self):
        self.store = Store(clerk)
        try:
            try:
                state = clerk.match(State, CD="CA")[0]
            except:
                state = State(CD="CA")
            state.salestax = FixedPoint("8.25")
            clerk.store(state)
        except:
            pass


    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_fakedata(self):
        import fakedata
        fakedata.load()
Example #6
0
class StoreTest(unittest.TestCase):
    __ver__ = "$Id$"

    def setUp(self):
        self.store = Store(clerk)
        try:
            try:
                state = clerk.match(State, CD="CA")[0]
            except:
                state = State(CD="CA")
            state.salestax = FixedPoint("8.25")
            clerk.store(state)
        except:
            pass

    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_fakedata(self):
        import fakedata
        fakedata.load()