def test_pending(self): try: investor = InvestorAccount() except LCError: pytest.skip("skip test: can't find account info") txns = transfer.pending(investor.id()) assert isinstance(txns, collections.abc.Iterable)
def test_cancel(self): try: investor = InvestorAccount() except LCError: pytest.skip("skip test: can't find account info") response = transfer.cancel(investor.id()) assert response is None
def test_withdrawal(self): try: investor = InvestorAccount() except LCError: pytest.skip("skip test: can't find account info") with pytest.raises(LCError): transfer.withdraw(investor.id(), 0) with pytest.raises(LCError): transfer.withdraw(investor.id(), -1)
def test_add(self): try: investor = InvestorAccount() except LCError: pytest.skip("skip test: can't find account info") with pytest.raises(LCError): transfer.add(investor.id(), 0) with pytest.raises(LCError): transfer.add(investor.id(), -1) with pytest.raises(LCError): transfer.add(investor.id(), 1, frequency='FOO') with pytest.raises(LCError): transfer.add(investor.id(), 1, frequency=TransferFrequency.BIWEEKLY) with pytest.raises(LCError): transfer.add(investor.id(), 1, frequency=TransferFrequency.BIWEEKLY, start_date='foo') with pytest.raises(LCError): transfer.add(investor.id(), 1, frequency=TransferFrequency.BIWEEKLY, start_date=datetime.datetime.now(), end_date='foo')
def test_properties(self): try: investor = InvestorAccount() except LCError: pytest.skip("skip because cannot find account ID") assert investor.available_balance >= 0.0 assert investor.total_balance >= 0.0
def test_properties(self): investor_id = None try: investor_id = InvestorAccount.id() except LCError: pytest.skip("skip because cannot find account ID") notes = Notes(investor_id) assert notes.successful assert len(notes) >= 0
def test_order(self): try: _ = Authorization().key except LCError: pytest.skip("skip test: cannot find authorization key") # Search loans matching our criteria listing = loan.Listing() listing.search() loans = listing.filter( FilterByTerm(value=36), FilterByGrade(grades='AB'), FilterByFunded(percentage=80), FilterByApproved(), ) # Now narrow it down to borrowers with specific traits traits = (BorrowerEmployedTrait(), ) loans = loans.filter(FilterByBorrowerTraits(traits)) account = InvestorAccount() balance = account.available_balance # Diversify notes = list() for selected_loan in loans: if balance >= 25: note = OrderNote(selected_loan.id, 25) balance -= 25 notes.append(note) else: break if notes: order = Order(account.id(), *notes) assert order.successful