Beispiel #1
0
    def test_does_not_creates_payment_processor_customer_information_with_invalid_customer(
            self, database):
        name = 'braintreetest'
        information = {'customer_id': 'someid'}

        customer = Customer(id=uuid.uuid4(),
                            first_name='None',
                            last_name='Existing',
                            company='Really Cool LTD',
                            email='*****@*****.**',
                            phone='+1111111111',
                            fax='+12222222222',
                            website='https://www.reallycool.test')

        with pytest.raises(InvalidCustomer):
            PaymentProcessorCustomerInformation.create(name=name,
                                                       customer=customer,
                                                       information=information)

        assert PaymentProcessorCustomerInformation.query.filter_by(
            customer_id=customer.id).first() is None
Beispiel #2
0
    def test_does_not_create_payment_method_with_invalid_customer(
            self, database):
        customer = Customer(id=uuid.uuid4(),
                            first_name='None',
                            last_name='Existing',
                            company='Really Cool LTD',
                            email='*****@*****.**',
                            phone='+1111111111',
                            fax='+12222222222',
                            website='https://www.reallycool.test')

        details = {
            'card_holder_name': 'Test Coool',
            'number': '1111' * 4,
            'cvv': '111',
            'expiration_date': '12/99'
        }

        with pytest.raises(InvalidCustomer):
            payment_method = PaymentMethod.create(customer=customer,
                                                  details=details)

        assert PaymentMethod.query.filter_by(
            customer_id=customer.id).first() is None