aboutsummaryrefslogtreecommitdiff
path: root/tests/managers/thl/test_ledger/test_lm_tx_entries.py
blob: 5bf1c48f5bc839b98420436809c0a96279885ad5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from generalresearch.models.thl.ledger import LedgerEntry


class TestLedgerEntryManager:

    def test_get_tx_entries_by_tx(self, ledger_tx, lm):
        # First confirm the Ledger TX exists with 2 Entries
        res = lm.get_tx_by_id(transaction_id=ledger_tx.id)
        assert len(res.entries) == 2

        tx_entries = lm.get_tx_entries_by_tx(transaction=ledger_tx)
        assert len(tx_entries) == 2

        assert res.entries == tx_entries
        assert isinstance(tx_entries[0], LedgerEntry)

    def test_get_tx_entries_by_txs(self, ledger_tx, lm):
        # First confirm the Ledger TX exists with 2 Entries
        res = lm.get_tx_by_id(transaction_id=ledger_tx.id)
        assert len(res.entries) == 2

        tx_entries = lm.get_tx_entries_by_txs(transactions=[ledger_tx])
        assert len(tx_entries) == 2

        assert res.entries == tx_entries
        assert isinstance(tx_entries[0], LedgerEntry)