Exemplo n.º 1
0
    def test_prod_config(self):
        """ Tests if the production config loads correctly """

        app = create_app("sd5.settings.ProdConfig", env="prod")

        assert app.config["SQLALCHEMY_DATABASE_URI"] == "sqlite:///../database.db"
        assert app.config["CACHE_TYPE"] == "simple"
Exemplo n.º 2
0
    def test_dev_config(self):
        """ Tests if the development config loads correctly """

        app = create_app("sd5.settings.DevConfig", env="dev")

        assert app.config["DEBUG"] is True
        assert app.config["SQLALCHEMY_DATABASE_URI"] == "sqlite:///../database.db"
        assert app.config["CACHE_TYPE"] == "null"
Exemplo n.º 3
0
    def test_prod_config(self):
        """ Tests if the production config loads correctly """

        app = create_app('sd5.settings.ProdConfig', env='prod')

        assert app.config[
            'SQLALCHEMY_DATABASE_URI'] == 'sqlite:///../database.db'
        assert app.config['CACHE_TYPE'] == 'simple'
Exemplo n.º 4
0
    def test_test_config(self):
        """ Tests if the test config loads correctly """

        app = create_app("sd5.settings.TestConfig", env="dev")

        assert app.config["DEBUG"] is True
        assert app.config["SQLALCHEMY_ECHO"] is True
        assert app.config["CACHE_TYPE"] == "null"
Exemplo n.º 5
0
    def test_test_config(self):
        """ Tests if the test config loads correctly """

        app = create_app('sd5.settings.TestConfig', env='dev')

        assert app.config['DEBUG'] is True
        assert app.config['SQLALCHEMY_ECHO'] is True
        assert app.config['CACHE_TYPE'] == 'null'
Exemplo n.º 6
0
    def test_dev_config(self):
        """ Tests if the development config loads correctly """

        app = create_app('sd5.settings.DevConfig', env='dev')

        assert app.config['DEBUG'] is True
        assert app.config[
            'SQLALCHEMY_DATABASE_URI'] == 'sqlite:///../database.db'
        assert app.config['CACHE_TYPE'] == 'null'
Exemplo n.º 7
0
    def test_connection(self):
        """ Test successful connection to Odoo RPC """

        app = create_app('sd5.settings.TestConfig', env='dev')
        conn = Connection(app.config)
        uid = conn.uid
        db = conn.db
        url = conn.url
        username = conn.username
        password = conn.password

        assert uid is not None
        assert db is not None
        assert url is not None
        assert username is not None
        assert password is not None
Exemplo n.º 8
0
def testapp(request):
    app = create_app('sd5.settings.TestConfig', env='dev')
    client = app.test_client()

    db.app = app
    db.create_all()

    if getattr(request.module, "create_user", True):
        admin = User('admin', 'supersafepassword')
        db.session.add(admin)
        db.session.commit()

    def teardown():
        db.session.remove()
        db.drop_all()

    request.addfinalizer(teardown)

    return client
Exemplo n.º 9
0
def testapp(request):
    app = create_app('sd5.settings.TestConfig', env='dev')
    client = app.test_client()

    db.app = app
    db.create_all()

    if getattr(request.module, "create_user", True):
        admin = User('admin', 'supersafepassword')
        db.session.add(admin)
        db.session.commit()

    def teardown():
        db.session.remove()
        db.drop_all()

    request.addfinalizer(teardown)

    return client
Exemplo n.º 10
0
def testappcfg():
    app = create_app('sd5.settings.TestConfig', env='dev')
    return app
Exemplo n.º 11
0
#!/usr/bin/env python

import os

from flask.ext.script import Manager, Server
from flask.ext.script.commands import ShowUrls, Clean
from sd5 import create_app
from sd5.models import db, User

# default to dev config because no one should use this in
# production anyway
env = os.environ.get('APPNAME_ENV', 'dev')
app = create_app('sd5.settings.%sConfig' % env.capitalize(), env=env)

manager = Manager(app)
manager.add_command("server", Server())
manager.add_command("show-urls", ShowUrls())
manager.add_command("clean", Clean())


@manager.shell
def make_shell_context():
    """ Creates a python REPL with several default imports
        in the context of the app
    """

    return dict(app=app, db=db, User=User)


@manager.command
def createdb():
Exemplo n.º 12
0
#!/usr/bin/env python

import os

from flask.ext.script import Manager, Server
from flask.ext.script.commands import ShowUrls, Clean
from sd5 import create_app
from sd5.models import db, User

# default to dev config because no one should use this in
# production anyway
env = os.environ.get('APPNAME_ENV', 'dev')
app = create_app('sd5.settings.%sConfig' % env.capitalize(), env=env)

manager = Manager(app)
manager.add_command("server", Server())
manager.add_command("show-urls", ShowUrls())
manager.add_command("clean", Clean())


@manager.shell
def make_shell_context():
    """ Creates a python REPL with several default imports
        in the context of the app
    """

    return dict(app=app, db=db, User=User)


@manager.command
def createdb():
Exemplo n.º 13
0
def testappcfg():
    app = create_app('sd5.settings.TestConfig', env='dev')
    return app