示例#1
0
文件: conftest.py 项目: ackermann/h
def settings():
    """Default app settings."""
    settings = {}
    settings['sqlalchemy.url'] = database_url(
        os.environ.get('TEST_DATABASE_URL',
                       'postgresql://postgres@localhost/htest'))
    return settings
示例#2
0
def settings():
    """Default app settings (conf/test.ini)."""
    settings = {
        'sqlalchemy.url': 'postgresql://postgres@localhost/htest',
    }

    if 'TEST_DATABASE_URL' in os.environ:
        settings['sqlalchemy.url'] = database_url(
            os.environ['TEST_DATABASE_URL'])

    return settings
示例#3
0
def settings():
    """Default app settings (conf/test.ini)."""
    settings = {
        'sqlalchemy.url': 'postgresql://postgres@localhost/htest',
    }

    if 'TEST_DATABASE_URL' in os.environ:
        settings['sqlalchemy.url'] = database_url(
            os.environ['TEST_DATABASE_URL'])

    return settings
示例#4
0
def test_database_url():
    url = "postgres://postgres:1234/database"
    expected = "postgresql+psycopg2://postgres:1234/database"

    assert database_url(url) == expected
示例#5
0
import click.testing
import sqlalchemy
from pyramid import testing
from pyramid.request import apply_request_extensions
from sqlalchemy.orm import sessionmaker
from webob.multidict import MultiDict

from h import db
from h import form
from h.settings import database_url
from h._compat import text_type

TEST_AUTHORITY = 'example.com'
TEST_DATABASE_URL = database_url(
    os.environ.get('TEST_DATABASE_URL',
                   'postgresql://postgres@localhost/htest'))

Session = sessionmaker()


class DummyFeature(object):
    """
    A dummy feature flag looker-upper.

    Because we're probably testing all feature-flagged functionality, this
    feature client defaults every flag to *True*, which is the exact opposite
    of what happens outside of testing.
    """
    def __init__(self):
        self.flags = {}
示例#6
0
文件: env.py 项目: kaydoh/h
def get_database_url():
    if "DATABASE_URL" in os.environ:
        return database_url(os.environ["DATABASE_URL"])
    return config.get_main_option("sqlalchemy.url")
示例#7
0
文件: env.py 项目: nlisgo/h
def get_database_url():
    if 'DATABASE_URL' in os.environ:
        return database_url(os.environ['DATABASE_URL'])
    return config.get_main_option("sqlalchemy.url")
示例#8
0
文件: conftest.py 项目: nlisgo/h
import deform
import mock
import pytest

import click.testing
import sqlalchemy
from pyramid import testing
from pyramid.request import apply_request_extensions
from sqlalchemy.orm import sessionmaker

from h import db
from h import form
from h.settings import database_url
from h._compat import text_type

TEST_DATABASE_URL = database_url(os.environ.get('TEST_DATABASE_URL',
                                                'postgresql://postgres@localhost/htest'))

Session = sessionmaker()


class DummyFeature(object):

    """
    A dummy feature flag looker-upper.

    Because we're probably testing all feature-flagged functionality, this
    feature client defaults every flag to *True*, which is the exact opposite
    of what happens outside of testing.
    """

    def __init__(self):
示例#9
0
def test_database_url():
    url = 'postgres://postgres:1234/database'
    expected = 'postgresql+psycopg2://postgres:1234/database'

    assert settings.database_url(url) == expected
示例#10
0
def test_database_url():
    url = "postgres://postgres:1234/database"
    expected = "postgresql+psycopg2://postgres:1234/database"

    assert database_url(url) == expected
示例#11
0
import sqlalchemy
from pyramid import testing
from pyramid.request import apply_request_extensions
from sqlalchemy.orm import sessionmaker
from webob.multidict import MultiDict

from h import db
from h import models
from h.settings import database_url
from h._compat import text_type
from tests.common.fixtures import es_client  # noqa: F401
from tests.common.fixtures import init_elasticsearch  # noqa: F401

TEST_AUTHORITY = "example.com"
TEST_DATABASE_URL = database_url(
    os.environ.get("TEST_DATABASE_URL", "postgresql://postgres@localhost/htest")
)

Session = sessionmaker()


class DummyFeature:

    """
    A dummy feature flag looker-upper.

    Because we're probably testing all feature-flagged functionality, this
    feature client defaults every flag to *True*, which is the exact opposite
    of what happens outside of testing.
    """
示例#12
0
文件: conftest.py 项目: ackermann/h
def settings():
    """Default app settings."""
    settings = {}
    settings['sqlalchemy.url'] = database_url(os.environ.get('TEST_DATABASE_URL',
                                                             'postgresql://postgres@localhost/htest'))
    return settings
示例#13
0
文件: conftest.py 项目: hypothesis/h
import sqlalchemy
from pyramid import testing
from pyramid.request import apply_request_extensions
from sqlalchemy.orm import sessionmaker
from webob.multidict import MultiDict

from h import db
from h import models
from h.settings import database_url
from h._compat import text_type
from tests.common.fixtures import es_client  # noqa: F401
from tests.common.fixtures import init_elasticsearch  # noqa: F401

TEST_AUTHORITY = "example.com"
TEST_DATABASE_URL = database_url(
    os.environ.get("TEST_DATABASE_URL", "postgresql://postgres@localhost/htest")
)

Session = sessionmaker()


class DummyFeature(object):

    """
    A dummy feature flag looker-upper.

    Because we're probably testing all feature-flagged functionality, this
    feature client defaults every flag to *True*, which is the exact opposite
    of what happens outside of testing.
    """