Ejemplo n.º 1
0
    def test_should_not_return_error_given_new_values(self):
        customer = Customer(
            name="Test two",
            email="*****@*****.**",
            phone="222 4444 7777",
            address="Test address two"
        )
        customer_validation = CustomerValidation(customer)
        error = customer_validation.check_for_repeated_values()

        self.assertEqual(error, None)
Ejemplo n.º 2
0
    def test_should_return_error_given_repeated_values(self):
        customer = Customer(
            name="Test",
            email="*****@*****.**",
            phone="123 456 7891",
            address="Test address"
        )
        customer_validation = CustomerValidation(customer)
        error = customer_validation.check_for_repeated_values()

        self.assertNotEqual(error, None)
Ejemplo n.º 3
0
    def test_should_return_error_given_invalid_customer(self):
        customer_validation = CustomerValidation(self.customer)
        self.customer.name = ""
        error = customer_validation.validate()

        self.assertNotEqual(error, None)
Ejemplo n.º 4
0
    def test_should_return_error_given_emtpy_address(self):
        customer_validation = CustomerValidation(self.customer)
        self.customer.address = ""
        error = customer_validation.check_for_emtpy_values()

        self.assertNotEqual(error, None)
Ejemplo n.º 5
0
    def test_invalid_phone(self):
        customer_validation = CustomerValidation(self.customer)
        self.customer.phone = "string"
        error = customer_validation.validate_phone()

        self.assertNotEqual(error, None)
Ejemplo n.º 6
0
    def test_should_not_return_error_given_valid_customer(self):
        customer_validation = CustomerValidation(self.customer)
        error = customer_validation.validate()

        self.assertEqual(error, None)
Ejemplo n.º 7
0
    def test_with_plus_sign(self):
        customer_validation = CustomerValidation(self.customer)
        self.customer.phone = "+442 300 1411"
        error = customer_validation.validate_phone()

        self.assertEqual(error, None)
Ejemplo n.º 8
0
    def test_invalid_email(self):
        customer_validation = CustomerValidation(self.customer)
        self.customer.email = "test.email.com"
        error = customer_validation.validate_email()

        self.assertNotEqual(error, None)
Ejemplo n.º 9
0
    def test_invalid_name(self):
        customer_validation = CustomerValidation(self.customer)
        self.customer.name = "Test2"
        error = customer_validation.validate_name()

        self.assertNotEqual(error, None)
Ejemplo n.º 10
0
    def test_validate_name(self):
        customer_validation = CustomerValidation(self.customer)
        self.customer.name = "New Name"
        error = customer_validation.validate_name()

        self.assertEqual(error, None)
Ejemplo n.º 11
0
    def test_should_return_error_given_repeated_value(self):
        customer_validation = CustomerValidation(self.customer2)
        error = customer_validation.check_for_repeated_value("Test")

        self.assertNotEqual(error, None)