Beispiel #1
0
def settings():
    """Default app settings."""
    settings = {}
    settings['sqlalchemy.url'] = database_url(
        os.environ.get('TEST_DATABASE_URL',
                       'postgresql://postgres@localhost/htest'))
    return settings
Beispiel #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
Beispiel #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
Beispiel #4
0
def test_database_url():
    url = "postgres://postgres:1234/database"
    expected = "postgresql+psycopg2://postgres:1234/database"

    assert database_url(url) == expected
Beispiel #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 = {}
Beispiel #6
0
Datei: env.py Projekt: 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")
Beispiel #7
0
Datei: env.py Projekt: 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")
Beispiel #8
0
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):
Beispiel #9
0
def test_database_url():
    url = 'postgres://postgres:1234/database'
    expected = 'postgresql+psycopg2://postgres:1234/database'

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

    assert database_url(url) == expected
Beispiel #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.
    """
Beispiel #12
0
def settings():
    """Default app settings."""
    settings = {}
    settings['sqlalchemy.url'] = database_url(os.environ.get('TEST_DATABASE_URL',
                                                             'postgresql://postgres@localhost/htest'))
    return settings
Beispiel #13
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(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.
    """