示例#1
0
    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)
示例#2
0
    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
示例#3
0
    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)
示例#4
0
    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')
示例#5
0
    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
示例#6
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
示例#7
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