Exemple #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
Exemple #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
Exemple #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
Exemple #4
0
def test_database_url():
    url = "postgres://postgres:1234/database"
    expected = "postgresql+psycopg2://postgres:1234/database"

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

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

    assert database_url(url) == expected
Exemple #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.
    """
Exemple #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
Exemple #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.
    """