Example #1
0
        raise ValueError(
            'argument passed to --rabbit-config is not a valid file path')


redis_proc = factories.redis_proc()
redisdb = factories.redisdb('redis_proc')

postgresql_proc = factories.postgresql_proc()
postgresql = factories.postgresql('postgresql_proc')

mysql_proc = factories.mysql_proc()
mysql = factories.mysql('mysql_proc')


@pytest.fixture
def mysqldb(mysql):
    warnings.warn(
        '`mysqldb` fixture is deprecated. Please use `mysql` instead.',
        DeprecationWarning, 2)
    return mysql


elasticsearch_proc = factories.elasticsearch_proc()
elasticsearch = factories.elasticsearch('elasticsearch_proc')

rabbitmq_proc = factories.rabbitmq_proc()
rabbitmq = factories.rabbitmq('rabbitmq_proc')

mongo_proc = factories.mongo_proc()
mongodb = factories.mongodb('mongo_proc')
Example #2
0
from pytest_dbfixtures import factories


def test_mongo(mongodb):
    test_data = {
        "test1": "test1",
    }

    db = mongodb['test_db']
    db.test.insert(test_data)
    assert db.test.find_one()['test1'] == 'test1'


mongo_params = '--nojournal --noauth --nohttpinterface --noprealloc'

mongo_proc2 = factories.mongo_proc(port=27070, params=mongo_params)
mongodb2 = factories.mongodb('mongo_proc2')

mongo_proc3 = factories.mongo_proc(port=27071, params=mongo_params)
mongodb3 = factories.mongodb('mongo_proc3')


def test_third_mongo(mongodb, mongodb2, mongodb3):
    test_data_one = {
        "test1": "test1",
    }
    db = mongodb['test_db']
    db.test.insert(test_data_one)
    assert db.test.find_one()['test1'] == 'test1'

    test_data_two = {
Example #3
0
from pytest_dbfixtures import factories


def test_mongo(mongodb):
    test_data = {
        "test1": "test1",
    }

    db = mongodb['test_db']
    db.test.insert(test_data)
    assert db.test.find_one()['test1'] == 'test1'


mongo_proc2 = factories.mongo_proc(
    port=27070,
    params='--nojournal --noauth --nohttpinterface --noprealloc')  # noqa
mongodb2 = factories.mongodb('mongo_proc2', port=27070)

mongo_proc3 = factories.mongo_proc(
    port=27071,
    params='--nojournal --noauth --nohttpinterface --noprealloc')  # noqa
mongodb3 = factories.mongodb('mongo_proc3', port=27071)


def test_third_mongo(mongodb, mongodb2, mongodb3):
    test_data_one = {
        "test1": "test1",
    }
    db = mongodb['test_db']
    db.test.insert(test_data_one)
Example #4
0
from path import path

from pytest_dbfixtures import factories


def test_mongo(mongodb):
    test_data = {
        "test1": "test1",
    }

    db = mongodb['test_db']
    db.test.insert(test_data)
    assert db.test.find_one()['test1'] == 'test1'


mongo_proc2 = factories.mongo_proc(port=27070, params='--nojournal --noauth --nohttpinterface --noprealloc')  # noqa
mongodb2 = factories.mongodb('mongo_proc2', port=27070)

mongo_proc3 = factories.mongo_proc(port=27071, params='--nojournal --noauth --nohttpinterface --noprealloc')  # noqa
mongodb3 = factories.mongodb('mongo_proc3', port=27071)


def test_third_mongo(mongodb, mongodb2, mongodb3):
    test_data_one = {
        "test1": "test1",
    }
    db = mongodb['test_db']
    db.test.insert(test_data_one)
    assert db.test.find_one()['test1'] == 'test1'

    test_data_two = {
Example #5
0
        )


redis_proc = factories.redis_proc()
redisdb = factories.redisdb('redis_proc')

postgresql_proc = factories.postgresql_proc()
postgresql = factories.postgresql('postgresql_proc')

mysql_proc = factories.mysql_proc()
mysql = factories.mysql('mysql_proc')


@pytest.fixture
def mysqldb(mysql):
    warnings.warn(
        '`mysqldb` fixture is deprecated. Please use `mysql` instead.',
        DeprecationWarning,
        2
    )
    return mysql

elasticsearch_proc = factories.elasticsearch_proc()
elasticsearch = factories.elasticsearch('elasticsearch_proc')

rabbitmq_proc = factories.rabbitmq_proc()
rabbitmq = factories.rabbitmq('rabbitmq_proc')

mongo_proc = factories.mongo_proc()
mongodb = factories.mongodb('mongo_proc')
Example #6
0
from unittest import mock

import pytest
from pytest_dbfixtures import factories

mongo_proc = factories.mongo_proc(executable='/usr/local/bin/mongod',
                                  params='--nojournal --noauth '
                                  '--nohttpinterface --noprealloc')
test_mongodb = factories.mongodb('mongo_proc')


@pytest.yield_fixture(autouse=True)
def fx_database(test_mongodb):
    with mock.patch('crawler.database.MongoClient', return_value=test_mongodb):
        yield test_mongodb