Add config to blueprint and fix tests madness

There was a problem related to the import of the module
`bigchaindb.web.views`.
The module, when imported, inizialises a new `Bigchain` instance, and
this is wrong for testing and because it's a bad practice.

I spent more or less 2h finding out the problem.
This commit is contained in:
vrde 2016-03-03 01:40:40 +01:00
parent 6d808ba614
commit 41bd2545c9

View File

@ -7,13 +7,14 @@ Tasks:
"""
import os
import copy
import pytest
DB_NAME = 'bigchain_test_{}'.format(os.getpid())
config = {
CONFIG = {
'database': {
'name': DB_NAME
},
@ -36,7 +37,7 @@ def restore_config(request, node_config):
@pytest.fixture(scope='module')
def node_config():
return config
return copy.deepcopy(CONFIG)
@pytest.fixture
@ -50,7 +51,8 @@ def user_public_key():
@pytest.fixture
def b():
def b(request, node_config):
restore_config(request, node_config)
from bigchaindb import Bigchain
return Bigchain()