Exemplo n.º 1
0
    def test_diff(self):
        tx = Transaction.from_json(TEST_TRANSACTION, mint=mint)

        tx.tags.add(mint.tags['X Home'])
        diffs = tx.diff()
        assert len(diffs) == 0

        tx.tags.add(mint.tags['X BC'])
        diffs = tx.diff()
        assert 'tags' in diffs and len(diffs) == 1
        assert mint.tags['X BC'] in diffs['tags']['added']
        assert len(diffs['tags']['removed']) == 0

        tx.merchant = "LOL"
        diffs = tx.diff()
        assert 'merchant' in diffs and len(diffs) == 2
Exemplo n.º 2
0
 def test_tx(self):
     tx = Transaction.from_json(TEST_TRANSACTION, mint=mint)
     assert tx.mint == mint
     assert mint.tags['X Home'] in tx.tags
     assert mint.tags['Reimbursable'] in tx.tags
Exemplo n.º 3
0
 def test_tx_reuse(self):
     tx1 = Transaction.from_json(TEST_TRANSACTION, mint=mint)
     tx2 = Transaction.from_json(TEST_TRANSACTION, mint=mint)
     assert id(tx1) == id(tx2)