def testPaymentMethod(self):
        """
        """
        self.shop.manage_addProduct["iqpp.easyshop"].addPaymentMethodCriteria("c")
        v = IValidity(self.shop.c)
        
        self.login("newmember")

        cm = ICustomerManagement(self.shop)
        customer = cm.getAuthenticatedCustomer()

        customer.selected_payment_method = u"cash-on-delivery"
        self.assertEqual(v.isValid(), False)

        customer.selected_payment_method = u"prepayment"
        self.assertEqual(v.isValid(), False)

        self.shop.c.setPaymentMethods(["direct-debit"])
        self.assertEqual(v.isValid(), False)        

        self.shop.c.setPaymentMethods(["prepayment"])
        self.assertEqual(v.isValid(), True)

        self.shop.c.setPaymentMethods(["prepayment", "direct-debit"])
        self.assertEqual(v.isValid(), True)
Example #2
0
    def testPaymentMethod(self):
        """
        """
        self.shop.manage_addProduct["iqpp.easyshop"].addPaymentMethodCriteria(
            "c")
        v = IValidity(self.shop.c)

        self.login("newmember")

        cm = ICustomerManagement(self.shop)
        customer = cm.getAuthenticatedCustomer()

        customer.selected_payment_method = u"cash-on-delivery"
        self.assertEqual(v.isValid(), False)

        customer.selected_payment_method = u"prepayment"
        self.assertEqual(v.isValid(), False)

        self.shop.c.setPaymentMethods(["direct-debit"])
        self.assertEqual(v.isValid(), False)

        self.shop.c.setPaymentMethods(["prepayment"])
        self.assertEqual(v.isValid(), True)

        self.shop.c.setPaymentMethods(["prepayment", "direct-debit"])
        self.assertEqual(v.isValid(), True)
class TestCustomerManagement(EasyShopTestCase):
    """
    """
    def afterSetUp(self):
        """
        """
        super(TestCustomerManagement, self).afterSetUp()
        self.cm = ICustomerManagement(self.shop)

    def testAddCustomers(self):
        """
        """
        result = self.cm.addCustomer("c1")
        self.failIf(result == False)
        
        result = self.cm.addCustomer("c2")
        self.failIf(result == False)
        
        result = self.cm.addCustomer("c3")
        self.failIf(result == False)
        
        result = self.cm.addCustomer("c4")
        self.failIf(result == False)
        
        ids = [c.getId for c in self.cm.getCustomers()]
        self.assertEqual(ids, ["c1", "c2", "c3", "c4"])
                
    def testGetAuthenticatedCustomer_1(self):
        """As anonymous, returns standard customer
        """
        self.logout()
        customer = self.cm.getAuthenticatedCustomer()
        self.assertEqual(customer.getId(), "DUMMY_SESSION")

    def testGetAuthenticatedCustomer_2(self):
        """As member
        """
        self.login("newmember")
        customer = self.cm.getAuthenticatedCustomer()

        self.failUnless(ICustomer.providedBy(customer))
        self.assertEqual(customer.getId(), "newmember")
        
    def testGetCustomerById_1(self):
        """Existing customer
        """
        result = self.cm.addCustomer("c1")
        self.failIf(result == False)
        
        customer = self.cm.getCustomerById("c1")

        self.assertEqual(customer.getId(), "c1")
        self.failUnless(ICustomer.providedBy(customer))

    def testGetCustomerById_2(self):
        """Non-existing customer
        """
        customer = self.cm.getCustomerById("doe")
        self.assertEqual(customer, None)
class TestCustomerManagement(EasyShopTestCase):
    """
    """
    def afterSetUp(self):
        """
        """
        super(TestCustomerManagement, self).afterSetUp()
        self.cm = ICustomerManagement(self.shop)

    def testAddCustomers(self):
        """
        """
        result = self.cm.addCustomer("c1")
        self.failIf(result == False)

        result = self.cm.addCustomer("c2")
        self.failIf(result == False)

        result = self.cm.addCustomer("c3")
        self.failIf(result == False)

        result = self.cm.addCustomer("c4")
        self.failIf(result == False)

        ids = [c.getId for c in self.cm.getCustomers()]
        self.assertEqual(ids, ["c1", "c2", "c3", "c4"])

    def testGetAuthenticatedCustomer_1(self):
        """As anonymous, returns standard customer
        """
        self.logout()
        customer = self.cm.getAuthenticatedCustomer()
        self.assertEqual(customer.getId(), "DUMMY_SESSION")

    def testGetAuthenticatedCustomer_2(self):
        """As member
        """
        self.login("newmember")
        customer = self.cm.getAuthenticatedCustomer()

        self.failUnless(ICustomer.providedBy(customer))
        self.assertEqual(customer.getId(), "newmember")

    def testGetCustomerById_1(self):
        """Existing customer
        """
        result = self.cm.addCustomer("c1")
        self.failIf(result == False)

        customer = self.cm.getCustomerById("c1")

        self.assertEqual(customer.getId(), "c1")
        self.failUnless(ICustomer.providedBy(customer))

    def testGetCustomerById_2(self):
        """Non-existing customer
        """
        customer = self.cm.getCustomerById("doe")
        self.assertEqual(customer, None)
    def afterSetUp(self):
        """
        """
        super(TestDirectDebit, self).afterSetUp()

        self.login("newmember")
        cm = ICustomerManagement(self.shop)
        self.customer = cm.getAuthenticatedCustomer()

        self.customer.invokeFactory(
            "BankAccount",
            id="bank-account",
        )
 def afterSetUp(self):
     """
     """
     super(TestDirectDebit, self).afterSetUp()
     
     self.login("newmember")
     cm = ICustomerManagement(self.shop)
     self.customer = cm.getAuthenticatedCustomer()
     
     self.customer.invokeFactory(
         "BankAccount",
         id = "bank-account",
         )
    def testCountry(self):
        """
        """
        self.shop.manage_addProduct["iqpp.easyshop"].addCountryCriteria("c")
        self.shop.c.setCountries((u"USA",))
        v = IValidity(self.shop.c)
        
        self.login("newmember")

        cm = ICustomerManagement(self.shop)
        customer = cm.getAuthenticatedCustomer()
        
        customer.invokeFactory("Address", "address_1")

        customer.address_1.country = u"USA"
        self.assertEqual(v.isValid(), True)

        customer.address_1.country = u"Germany"
        self.assertEqual(v.isValid(), False)
Example #8
0
    def testCountry(self):
        """
        """
        self.shop.manage_addProduct["iqpp.easyshop"].addCountryCriteria("c")
        self.shop.c.setCountries((u"USA", ))
        v = IValidity(self.shop.c)

        self.login("newmember")

        cm = ICustomerManagement(self.shop)
        customer = cm.getAuthenticatedCustomer()

        customer.invokeFactory("Address", "address_1")

        customer.address_1.country = u"USA"
        self.assertEqual(v.isValid(), True)

        customer.address_1.country = u"Germany"
        self.assertEqual(v.isValid(), False)
 def afterSetUp(self):
     """
     """
     super(TestCustomerManagement, self).afterSetUp()
     self.cm = ICustomerManagement(self.shop)
 def afterSetUp(self):
     """
     """
     super(TestCustomerManagement, self).afterSetUp()
     self.cm = ICustomerManagement(self.shop)