Ignore:
Timestamp:
24 Nov 2014, 00:03:55 (10 years ago)
Author:
uli
Message:

Disable expensive paypal tests by default and add test for standard payment creation as shown in paypal docs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/tests/test_paypal.py

    r12029 r12043  
    2525from waeup.ikoba.payments.paypal import (
    2626    get_paypal_config_file_path, parse_paypal_config, get_access_token,
    27     configure_sdk,
     27    configure_sdk, get_payment,
    2828    )
    2929from waeup.ikoba.testing import (
    3030    FunctionalLayer, FunctionalTestCase,
    3131    )
     32
     33#
     34# PayPal test config
     35#
     36
     37EXTERNAL_PAYPAL_TESTS = False
     38
     39#
     40# End of PayPal test config
     41#
     42
     43
     44def external_paypal_test(func):
     45    """A decorator that can block test functions.
     46    """
     47    if not EXTERNAL_PAYPAL_TESTS:
     48        myself = __file__
     49        if myself.endswith('.pyc'):
     50            myself = myself[:-2]
     51        print "WARNING: external paypal tests are skipped!"
     52        print "WARNING: edit %s to enable them." % myself
     53        return
     54    return func
    3255
    3356
     
    97120
    98121class FunctionalPaypalTests(FunctionalTestCase):
    99     # XXX: The functional paypal tests are expensive
    100122
    101123    layer = FunctionalLayer
    102124
     125    @external_paypal_test
    103126    def test_get_access_token(self):
    104127        # we can get an access token
    105128        result = get_access_token()
    106129        assert isinstance(result, unicode)
     130
     131    @external_paypal_test
     132    def test_get_payment(self):
     133        # we can construct (paypal-)payment objects
     134        payment = get_payment()
     135        assert isinstance(payment, paypalrestsdk.Payment)
     136        result = payment.create()
     137        assert result is True
Note: See TracChangeset for help on using the changeset viewer.