Esempio n. 1
0
    def setUpVCR(cls):
        """Set up VCR.

        We use the VCR library to freeze API calls. Frozen calls are stored in
        tests/fixtures/ for your convenience (otherwise your first test run
        would take fooooorrr eeeevvveeerrrr). If you find that an API call has
        drifted from our frozen version of it, simply remove that fixture file
        and rerun. The VCR library should recreate the fixture with the new
        information, and you can commit that with your updated tests.

        """
        cls.vcr_cassette = use_cassette(cls.__name__).__enter__()
Esempio n. 2
0
    def setUpVCR(cls):
        """Set up VCR.

        We use the VCR library to freeze API calls. Frozen calls are stored in
        tests/fixtures/ for your convenience (otherwise your first test run
        would take fooooorrr eeeevvveeerrrr). If you find that an API call has
        drifted from our frozen version of it, simply remove that fixture file
        and rerun. The VCR library should recreate the fixture with the new
        information, and you can commit that with your updated tests.

        """
        cls.vcr_cassette = use_cassette(cls.__name__).__enter__()
Esempio n. 3
0
            balanced_customer_href=self.david_href)
        self.janet = self.make_participant(
            'janet',
            is_suspicious=False,
            claimed_time='now',
            balanced_customer_href=self.janet_href,
            last_bill_result='')
        self.homer = self.make_participant(
            'homer',
            is_suspicious=False,
            claimed_time='now',
            balanced_customer_href=self.homer_href,
            last_ach_result='')


with use_cassette('BalancedHarness'):
    cls = BalancedHarness
    balanced.configure(balanced.APIKey().save().secret)
    mp = balanced.Marketplace.my_marketplace
    if not mp:
        mp = balanced.Marketplace().save()
    cls.balanced_marketplace = mp

    cls.david_href = cls.make_balanced_customer()

    cls.janet_href = cls.make_balanced_customer()
    cls.card = balanced.Card(
        number='4111111111111111',
        expiration_month=10,
        expiration_year=2020,
        address={
Esempio n. 4
0
                                           claimed_time='now',
                                           balanced_customer_href=self.homer_href,
                                           last_ach_result='')

    @classmethod
    def tearDownClass(cls):
        has_exchange_id = balanced.Transaction.f.meta.contains('exchange_id')
        credits = balanced.Credit.query.filter(has_exchange_id)
        debits = balanced.Debit.query.filter(has_exchange_id)
        for t in itertools.chain(credits, debits):
            t.meta.pop('exchange_id')
            t.save()
        super(BalancedHarness, cls).tearDownClass()


with use_cassette('BalancedHarness'):
    cls = BalancedHarness
    balanced.configure(balanced.APIKey().save().secret)
    mp = balanced.Marketplace.my_marketplace
    if not mp:
        mp = balanced.Marketplace().save()
    cls.balanced_marketplace = mp

    cls.david_href = cls.make_balanced_customer()

    cls.janet_href = cls.make_balanced_customer()
    cls.card = balanced.Card(
        number='4111111111111111',
        expiration_month=10,
        expiration_year=2020,
        address={
Esempio n. 5
0
        has_exchange_id = balanced.Transaction.f.meta.contains('exchange_id')
        credits = balanced.Credit.query.filter(has_exchange_id)
        debits = balanced.Debit.query.filter(has_exchange_id)
        for t in itertools.chain(credits, debits):
            t.meta.pop('exchange_id')
            t.save()
        # Braintree Cleanup
        existing_holds = braintree.Transaction.search(
            braintree.TransactionSearch.status == 'authorized'
        )
        for hold in existing_holds.items:
            cancel_card_hold(hold)
        super(BillingHarness, cls).tearDownClass()


with use_cassette('BillingHarness'):
    cls = BillingHarness
    balanced.configure(balanced.APIKey().save().secret)
    mp = balanced.Marketplace.my_marketplace
    if not mp:
        mp = balanced.Marketplace().save()
    cls.balanced_marketplace = mp

    cls.david_href = cls.make_balanced_customer()

    cls.janet_href = cls.make_balanced_customer()
    cls.card = balanced.Card(
        number='4111111111111111',
        expiration_month=10,
        expiration_year=2020,
        address={
Esempio n. 6
0
        # A customer with Paypal attached.
        self.homer = self.make_participant('homer', is_suspicious=False,
                                           claimed_time='now')
        self.homer_route = ExchangeRoute.insert(self.homer, 'paypal', '*****@*****.**')


    @classmethod
    def tearDownClass(cls):
        # Braintree Cleanup
        existing_holds = braintree.Transaction.search(
            braintree.TransactionSearch.status == 'authorized'
        )
        for hold in existing_holds.items:
            cancel_card_hold(hold)
        super(BillingHarness, cls).tearDownClass()


with use_cassette('BillingHarness'):
    cls = BillingHarness

    cls.roman_bt_id = braintree.Customer.create().customer.id

    cls.obama_bt_id = braintree.Customer.create().customer.id

    cls.bt_card = braintree.PaymentMethod.create({
        "customer_id": cls.obama_bt_id,
        "payment_method_nonce": Nonces.Transactable
    }).payment_method

    cls.obama_cc_token = cls.bt_card.token