Added localmongodb marker

This commit is contained in:
kansi 2017-11-24 12:30:57 +05:30
parent 6c3f176122
commit fcfe577813
3 changed files with 46 additions and 42 deletions

View File

@ -3,7 +3,7 @@ from copy import deepcopy
import pytest
import pymongo
pytestmark = pytest.mark.tendermint
pytestmark = [pytest.mark.tendermint, pytest.mark.localmongodb]
@pytest.mark.bdb
@ -75,7 +75,6 @@ def test_get_assets():
@pytest.mark.bdb
@pytest.mark.tendermint
def test_text_search():
from ..mongodb.test_queries import test_text_search

View File

@ -25,6 +25,13 @@ USER_PRIVATE_KEY = '8eJ8q9ZQpReWyQT5aFCiwtZ5wDZC4eDnCen88p3tQ6ie'
USER_PUBLIC_KEY = 'JEAkEJqLbbgDRAtMm8YAjGp759Aq2qTn9eaEHUj2XePE'
def pytest_runtest_setup(item):
if isinstance(item, item.Function):
backend = item.session.config.getoption('--database-backend')
if (item.get_marker('localmongodb') and backend != 'localmongodb'):
pytest.skip('Skip tendermint specific tests if not using localmongodb')
def pytest_addoption(parser):
from bigchaindb.backend.connection import BACKENDS

View File

@ -87,11 +87,10 @@ def test_get_assets_limit(client, b):
@pytest.mark.bdb
@pytest.mark.tendermint
def test_get_assets_tmint(client, tb):
@pytest.mark.localmongodb
def test_get_assets_tendermint(client, tb):
from bigchaindb.models import Transaction
from bigchaindb.backend.localmongodb.connection import LocalMongoDBConnection
if isinstance(tb.connection, LocalMongoDBConnection):
# test returns empty list when no assets are found
res = client.get(ASSETS_ENDPOINT + '?search=abc')
assert res.json == []
@ -116,12 +115,11 @@ def test_get_assets_tmint(client, tb):
@pytest.mark.bdb
@pytest.mark.tendermint
def test_get_assets_limit_tmint(client, tb):
@pytest.mark.localmongodb
def test_get_assets_limit_tendermint(client, tb):
from bigchaindb.models import Transaction
from bigchaindb.backend.localmongodb.connection import LocalMongoDBConnection
b = tb
if isinstance(b.connection, LocalMongoDBConnection):
# create two assets
asset1 = {'msg': 'abc 1'}
asset2 = {'msg': 'abc 2'}