diff --git a/tests/backend/mongodb/test_connection.py b/tests/backend/mongodb/test_connection.py new file mode 100644 index 00000000..8d2c57b1 --- /dev/null +++ b/tests/backend/mongodb/test_connection.py @@ -0,0 +1,16 @@ + +def test_get_connection_returns_the_correct_instance(): + from bigchaindb.backend import connect + from bigchaindb.backend.connection import Connection + from bigchaindb.backend.mongodb.connection import MongoDBConnection + + config = { + 'backend': 'mongodb', + 'host': 'localhost', + 'port': 27017, + 'name': 'test' + } + + conn = connect(**config) + assert isinstance(conn, Connection) + assert isinstance(conn, MongoDBConnection) diff --git a/tests/backend/rethinkdb/test_connection.py b/tests/backend/rethinkdb/test_connection.py new file mode 100644 index 00000000..46d49dd8 --- /dev/null +++ b/tests/backend/rethinkdb/test_connection.py @@ -0,0 +1,16 @@ + +def test_get_connection_returns_the_correct_instance(): + from bigchaindb.backend import connect + from bigchaindb.backend.connection import Connection + from bigchaindb.backend.rethinkdb.connection import RethinkDBConnection + + config = { + 'backend': 'rethinkdb', + 'host': 'localhost', + 'port': 28015, + 'name': 'test' + } + + conn = connect(**config) + assert isinstance(conn, Connection) + assert isinstance(conn, RethinkDBConnection) diff --git a/tests/backend/test_connection.py b/tests/backend/test_connection.py index bdc336a9..7b49f45e 100644 --- a/tests/backend/test_connection.py +++ b/tests/backend/test_connection.py @@ -1,23 +1,6 @@ import pytest -def test_get_connection_returns_the_correct_instance(): - from bigchaindb.backend import connect - from bigchaindb.backend.connection import Connection - from bigchaindb.backend.rethinkdb.connection import RethinkDBConnection - - config = { - 'backend': 'rethinkdb', - 'host': 'localhost', - 'port': 28015, - 'name': 'test' - } - - conn = connect(**config) - assert isinstance(conn, Connection) - assert isinstance(conn, RethinkDBConnection) - - def test_get_connection_raises_a_configuration_error(monkeypatch): from bigchaindb.common.exceptions import ConfigurationError from bigchaindb.backend import connect @@ -28,6 +11,7 @@ def test_get_connection_raises_a_configuration_error(monkeypatch): with pytest.raises(ConfigurationError): # We need to force a misconfiguration here monkeypatch.setattr('bigchaindb.backend.connection.BACKENDS', - {'catsandra': 'bigchaindb.backend.meowmeow.Catsandra'}) + {'catsandra': + 'bigchaindb.backend.meowmeow.Catsandra'}) connect('catsandra', 'localhost', '1337', 'mydb')