コード例 #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
ファイル: conftest.py プロジェクト: badgettrg/Webmarks
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
ファイル: settings_test.py プロジェクト: hypothesis/h
def test_database_url():
    url = "postgres://postgres:1234/database"
    expected = "postgresql+psycopg2://postgres:1234/database"

    assert database_url(url) == expected
コード例 #11
0
ファイル: conftest.py プロジェクト: Manuelinux/kubeh
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.
    """