mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Fix misc tests affected by changes related to database abstraction
This commit is contained in:
parent
9e3bca7e85
commit
941b47d1ac
@ -1,7 +1,7 @@
|
||||
from unittest.mock import patch
|
||||
|
||||
from multipipes import Pipe
|
||||
from bigchaindb.db.utils import Connection
|
||||
from bigchaindb.backend.connection import Connection
|
||||
from bigchaindb.pipelines.utils import ChangeFeed
|
||||
|
||||
|
||||
|
@ -62,12 +62,12 @@ def test_bigchain_class_initialization_with_parameters(config):
|
||||
|
||||
|
||||
def test_get_blocks_status_containing_tx(monkeypatch):
|
||||
from bigchaindb.db.backends.rethinkdb import RethinkDBBackend
|
||||
from bigchaindb.backend import query as backend_query
|
||||
from bigchaindb.core import Bigchain
|
||||
blocks = [
|
||||
{'id': 1}, {'id': 2}
|
||||
]
|
||||
monkeypatch.setattr(RethinkDBBackend, 'get_blocks_status_from_transaction', lambda x: blocks)
|
||||
monkeypatch.setattr(backend_query, 'get_blocks_status_from_transaction', lambda x: blocks)
|
||||
monkeypatch.setattr(Bigchain, 'block_election_status', lambda x, y, z: Bigchain.BLOCK_VALID)
|
||||
bigchain = Bigchain(public_key='pubkey', private_key='privkey')
|
||||
with pytest.raises(Exception):
|
||||
|
@ -3,11 +3,11 @@ import pytest
|
||||
|
||||
import rethinkdb as r
|
||||
|
||||
from bigchaindb.db.utils import Connection
|
||||
from bigchaindb.backend import connect
|
||||
|
||||
|
||||
def test_run_a_simple_query():
|
||||
conn = Connection()
|
||||
conn = connect()
|
||||
query = r.expr('1')
|
||||
assert conn.run(query) == '1'
|
||||
|
||||
@ -17,7 +17,7 @@ def test_raise_exception_when_max_tries():
|
||||
def run(self, conn):
|
||||
raise r.ReqlDriverError('mock')
|
||||
|
||||
conn = Connection()
|
||||
conn = connect()
|
||||
|
||||
with pytest.raises(r.ReqlDriverError):
|
||||
conn.run(MockQuery())
|
||||
@ -30,7 +30,7 @@ def test_reconnect_when_connection_lost():
|
||||
def raise_exception(*args, **kwargs):
|
||||
raise r.ReqlDriverError('mock')
|
||||
|
||||
conn = Connection()
|
||||
conn = connect()
|
||||
original_connect = r.connect
|
||||
r.connect = raise_exception
|
||||
|
||||
@ -75,7 +75,6 @@ def test_changefeed_reconnects_when_connection_lost(monkeypatch):
|
||||
else:
|
||||
time.sleep(10)
|
||||
|
||||
|
||||
bigchain = Bigchain()
|
||||
bigchain.connection = MockConnection()
|
||||
changefeed = ChangeFeed('cat_facts', ChangeFeed.INSERT,
|
||||
|
Loading…
x
Reference in New Issue
Block a user