示例#1
0
# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
import datetime

sys.path.insert(0, os.path.abspath("."))

import incendiary  # noqa: ignore=E402
from insanic.conf import settings  # noqa: ignore=E402

settings.configure()

on_rtd = os.environ.get("READTHEDOCS", None) == "True"

# -- Project information -----------------------------------------------------

project = "Incendiary"
author = incendiary.__author__
version = incendiary.__version__

release = version
this_year = datetime.date.today().year
copyright = "%s, %s" % (this_year, author)

# -- General configuration ---------------------------------------------------
示例#2
0
from itertools import permutations

from insanic import Insanic
from insanic.conf import settings
from insanic.functional import empty
from pytest_redis import factories

from iniesta.app import Iniesta
from iniesta.choices import InitializationTypes
from iniesta.sessions import BotoSession


settings.configure(
    SERVICE_NAME="iniesta",
    ENFORCE_APPLICATION_VERSION=False,
    AWS_ACCESS_KEY_ID="testing",
    AWS_SECRET_ACCESS_KEY="testing",
    AWS_DEFAULT_REGION="us-east-1",
    ENVIRONMENT="tests",
)

for cache_name, cache_config in settings.INSANIC_CACHES.items():
    globals()[f"redisdb_{cache_name}"] = factories.redisdb(
        "redis_nooproc", dbnum=cache_config.get("DATABASE")
    )

redisdb = factories.redisdb("redis_nooproc")


@pytest.fixture(autouse=True)
def insanic_application():
    app = Insanic("xavi")
示例#3
0
def reset_settings():
    settings._wrapped = empty
    settings.configure(SERVICE_NAME="test", ENFORCE_APPLICATION_VERSION=False)
示例#4
0
import pytest
import uuid

from calendar import timegm

from insanic import Insanic
from insanic.authentication import handlers
from insanic.choices import UserLevels
from insanic.conf import settings
from insanic.functional import empty
from insanic.models import User

from pytest_redis import factories

settings.configure(
    SERVICE_NAME="insanic", ENFORCE_APPLICATION_VERSION=False,
)

for cache_name, cache_config in settings.INSANIC_CACHES.items():
    globals()[f"redisdb_{cache_name}"] = factories.redisdb(
        "redis_nooproc", dbnum=cache_config.get("DATABASE")
    )

redisdb = factories.redisdb("redis_nooproc")


@pytest.fixture(scope="session")
def session_id():
    return uuid.uuid4().hex

示例#5
0
import pytest

from botocore.endpoint import Endpoint
from insanic import Insanic
from insanic.conf import settings

settings.configure(
    SERVICE_NAME="tracer",
    AWS_ACCESS_KEY_ID="testing",
    AWS_SECRET_ACCESS_KEY="testing",
    AWS_DEFAULT_REGION="us-east-1",
    ENVIRONMENT="tests",
)


@pytest.fixture(autouse=True)
def insanic_application():
    app = Insanic("trace", version="0.1.0")

    yield app


#
# @pytest.fixture(autouse=True)
# def set_redis_connection_info(redisdb, monkeypatch):
#     port = redisdb.connection_pool.connection_kwargs['path'].split('/')[-1].split('.')[1]
#     db = redisdb.connection_pool.connection_kwargs['db']
#
#     monkeypatch.setattr(settings, 'REDIS_PORT', int(port))
#     monkeypatch.setattr(settings, 'REDIS_HOST', '127.0.0.1')
#     monkeypatch.setattr(settings, 'REDIS_DB', db)
示例#6
0
# from pytest_redis import factories
#
# redisdb = factories.redisdb("redis_nooproc")
#
import aioredis
import pytest
from insanic import Insanic
from insanic.conf import settings

from infuse import Infuse

settings.configure(ENVIRONMENT="test",
                   SERVICE_CONNECTIONS=["testone", "testtwo", "testthree"])


@pytest.fixture
def infuse_application():
    app = Insanic("infuse_app", version="0.1.0")

    Infuse.init_app(app)

    yield app


@pytest.fixture(autouse=True)
async def set_redis_connection_info(monkeypatch):

    host = "127.0.0.1"
    port = 6379

    insanic_caches = settings.INSANIC_CACHES.copy()