mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 14:35:45 +00:00
added wrong ConnectionError refereing
removed obsolete tests clear singleton before /after making DB connection tests Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
1fc856c05f
commit
1b76af8565
@ -9,7 +9,7 @@ import tarantool
|
|||||||
from planetmint.config import Config
|
from planetmint.config import Config
|
||||||
from transactions.common.exceptions import ConfigurationError
|
from transactions.common.exceptions import ConfigurationError
|
||||||
from planetmint.utils import Lazy
|
from planetmint.utils import Lazy
|
||||||
from planetmint.backend.connection import DBConnection
|
from planetmint.backend.connection import DBConnection, ConnectionError
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@ -7,12 +7,17 @@ import pytest
|
|||||||
|
|
||||||
|
|
||||||
def test_get_connection_raises_a_configuration_error(monkeypatch):
|
def test_get_connection_raises_a_configuration_error(monkeypatch):
|
||||||
from planetmint.backend.connection import Connection
|
from planetmint.backend.connection import ConnectionError
|
||||||
from planetmint.backend.localmongodb.connection import LocalMongoDBConnection
|
|
||||||
from planetmint.backend.tarantool.connection import TarantoolDBConnection
|
from planetmint.backend.tarantool.connection import TarantoolDBConnection
|
||||||
|
|
||||||
|
with pytest.raises(ConnectionError):
|
||||||
|
TarantoolDBConnection("localhost", "1337", "mydb", "password")
|
||||||
|
|
||||||
|
@pytest.mark.skip(reason="we currently do not suppport mongodb.")
|
||||||
|
def test_get_connection_raises_a_configuration_error_mongodb(monkeypatch):
|
||||||
|
from planetmint.backend.localmongodb.connection import LocalMongoDBConnection
|
||||||
from transactions.common.exceptions import ConfigurationError
|
from transactions.common.exceptions import ConfigurationError
|
||||||
|
|
||||||
with pytest.raises(ConnectionError):
|
with pytest.raises(ConnectionError):
|
||||||
LocalMongoDBConnection("localhost", "1337", "mydb", "password")
|
conn = LocalMongoDBConnection("localhost", "1337", "mydb", "password")
|
||||||
with pytest.raises(ConnectionError):
|
|
||||||
TarantoolDBConnection("localhost", "1337", "mydb", "password")
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ from planetmint.version import __tm_supported_versions__
|
|||||||
from transactions.types.assets.create import Create
|
from transactions.types.assets.create import Create
|
||||||
from transactions.types.assets.transfer import Transfer
|
from transactions.types.assets.transfer import Transfer
|
||||||
from transactions.common.exceptions import ConfigurationError
|
from transactions.common.exceptions import ConfigurationError
|
||||||
|
from planetmint.backend.connection import Connection, ConnectionError
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@ -38,20 +39,6 @@ def config(request, monkeypatch):
|
|||||||
monkeypatch.setattr("planetmint.config", config)
|
monkeypatch.setattr("planetmint.config", config)
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
def test_bigchain_class_initialization_with_parameters():
|
|
||||||
from planetmint.backend.localmongodb.connection import LocalMongoDBConnection
|
|
||||||
|
|
||||||
init_db_kwargs = {
|
|
||||||
"backend": "localmongodb",
|
|
||||||
"host": "this_is_the_db_host",
|
|
||||||
"port": 12345,
|
|
||||||
"name": "this_is_the_db_name",
|
|
||||||
}
|
|
||||||
with pytest.raises(ConfigurationError):
|
|
||||||
LocalMongoDBConnection(**init_db_kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
def test_bigchain_class_default_initialization(config):
|
def test_bigchain_class_default_initialization(config):
|
||||||
from planetmint import Planetmint
|
from planetmint import Planetmint
|
||||||
from planetmint.validation import BaseValidationRules
|
from planetmint.validation import BaseValidationRules
|
||||||
@ -65,7 +52,8 @@ def test_bigchain_class_default_initialization(config):
|
|||||||
@pytest.mark.bdb
|
@pytest.mark.bdb
|
||||||
def test_get_spent_issue_1271(b, alice, bob, carol):
|
def test_get_spent_issue_1271(b, alice, bob, carol):
|
||||||
from planetmint import Planetmint
|
from planetmint import Planetmint
|
||||||
|
connection = Connection()
|
||||||
|
del connection
|
||||||
planet = Planetmint()
|
planet = Planetmint()
|
||||||
print(f" CONNECTION HOST : {planet.connection.host}")
|
print(f" CONNECTION HOST : {planet.connection.host}")
|
||||||
tx_1 = Create.generate(
|
tx_1 = Create.generate(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user