Fix test_transaction_exists

This commit is contained in:
vrde 2016-10-27 16:50:30 +02:00
parent 4585b7b5ae
commit 40ba9d8c6a
No known key found for this signature in database
GPG Key ID: 6581C7C39B3D397D

View File

@ -84,11 +84,9 @@ def test_has_previous_vote(monkeypatch):
bigchain.has_previous_vote(block) bigchain.has_previous_vote(block)
@pytest.mark.skipif(reason='meh') @pytest.mark.parametrize('count,exists', ((1, True), (0, False)))
@pytest.mark.parametrize('items,exists', (((0,), True), ((), False))) def test_transaction_exists(monkeypatch, count, exists):
def test_transaction_exists(monkeypatch, items, exists):
from bigchaindb.core import Bigchain from bigchaindb.core import Bigchain
monkeypatch.setattr( monkeypatch.setattr(RqlQuery, 'run', lambda x, y: count)
RqlQuery, 'run', lambda x, y: namedtuple('response', 'items')(items))
bigchain = Bigchain(public_key='pubkey', private_key='privkey') bigchain = Bigchain(public_key='pubkey', private_key='privkey')
assert bigchain.transaction_exists('txid') is exists assert bigchain.transaction_exists('txid') is exists