예제 #1
0
 def test_associate_invalid_card(self): #, find):
     billing.associate( self.db
                      , u"credit card"
                      , self.david
                      , self.david.get_balanced_account()
                      , '/cards/CC123123123123',  # invalid href
                       )
     david = Participant.from_username('david')
     assert david.last_bill_result == '404 Client Error: NOT FOUND'
예제 #2
0
 def test_associate_invalid_card(self): #, find):
     billing.associate( self.db
                      , u"credit card"
                      , 'david'
                      , self.david_href
                      , '/cards/CC123123123123',  # invalid href
                       )
     david = Participant.from_username('david')
     assert david.last_bill_result == '404 Client Error: NOT FOUND'
예제 #3
0
    def test_associate_bank_account_invalid(self):

        billing.associate( self.db
                         , u"bank account"
                         , self.david
                         , self.david.get_balanced_account()
                         , '/bank_accounts/BA123123123123123123' # invalid href
                          )

        david = Participant.from_username('david')
        assert david.last_ach_result == '404 Client Error: NOT FOUND'
예제 #4
0
    def test_associate_bank_account_invalid(self):

        billing.associate( self.db
                         , u"bank account"
                         , 'david'
                         , self.david_href
                         , '/bank_accounts/BA123123123123123123' # invalid href
                          )

        david = Participant.from_username('david')
        assert david.last_ach_result == '404 Client Error: NOT FOUND'
예제 #5
0
    def test_associate_bank_account_valid(self):
        bank_account = balanced.BankAccount( name='Alice G. Krebs'
                                           , routing_number='321174851'
                                           , account_number='9900000001'
                                           , account_type='checking'
                                            ).save()
        customer = self.david.get_balanced_account()
        billing.associate( self.db
                         , u"bank account"
                         , self.david
                         , customer
                         , unicode(bank_account.href)
                          )

        bank_accounts = customer.bank_accounts.all()
        assert len(bank_accounts) == 1
        assert bank_accounts[0].href == unicode(bank_account.href)

        david = Participant.from_username('david')
        assert david.last_ach_result == ''
예제 #6
0
    def test_associate_valid_card(self):
        self.david.set_tip_to(self.homer, 10)
        card = balanced.Card(
            number='4242424242424242',
            expiration_year=2020,
            expiration_month=12
        ).save()
        customer = self.david.get_balanced_account()
        billing.associate( self.db
                         , 'credit card'
                         , self.david
                         , customer
                         , unicode(card.href)
                          )

        cards = customer.cards.all()
        assert len(cards) == 1
        assert cards[0].href == card.href

        homer = Participant.from_id(self.homer.id)
        assert homer.receiving == 10
예제 #7
0
    def test_associate_valid_card(self):
        self.david.set_tip_to(self.homer, 10)
        card = balanced.Card(
            number='4242424242424242',
            expiration_year=2020,
            expiration_month=12
        ).save()
        billing.associate( self.db
                         , 'credit card'
                         , 'david'
                         , self.david_href
                         , unicode(card.href)
                          )

        customer = balanced.Customer.fetch(self.david_href)
        cards = customer.cards.all()
        assert len(cards) == 1
        assert cards[0].href == card.href

        homer = Participant.from_id(self.homer.id)
        assert homer.receiving == 10
예제 #8
0
    def test_associate_bank_account_valid(self):
        bank_account = balanced.BankAccount( name='Alice G. Krebs'
                                           , routing_number='321174851'
                                           , account_number='9900000001'
                                           , account_type='checking'
                                            ).save()
        billing.associate( self.db
                         , u"bank account"
                         , 'david'
                         , self.david_href
                         , unicode(bank_account.href)
                          )

        #args, _ = find.call_args

        customer = balanced.Customer.fetch(self.david_href)
        bank_accounts = customer.bank_accounts.all()
        assert len(bank_accounts) == 1
        assert bank_accounts[0].href == unicode(bank_account.href)

        david = Participant.from_username('david')
        assert david.last_ach_result == ''