コード例 #1
0
def configure_app(mode=None):
    mode_map = {
        'test': 'collector.api.config.Testing',
        'prod': 'collector.api.config.Production'
    }
    app.config.from_object(mode_map.get(mode))
    log.init_logger()
    return app
コード例 #2
0
def configure_app(mode=None):
    mode_map = {
        'test': 'collector.api.config.Testing',
        'prod': 'collector.api.config.Production'
    }
    app.config.from_object(mode_map.get(mode))
    log.init_logger()
    return app
コード例 #3
0
def configure_app(mode=None):
    mode_map = {
        'test': 'collector.api.config.Testing',
        'prod': 'collector.api.config.Production'
    }
    app.config.from_object(mode_map.get(mode))
    app.config.from_envvar('COLLECTOR_SETTINGS', silent=True)
    index_filtering_rules(app)
    setattr(app_module, 'db', flask_sqlalchemy.SQLAlchemy(app))
    log.init_logger()
    return app
コード例 #4
0
ファイル: base.py プロジェクト: katepimenova/fuel-stats
from flask import json
import flask_migrate
import os
from unittest2.case import TestCase

from collector.api.app import app
from collector.api.app import db
from collector.api.log import init_logger


flask_migrate.Migrate(app, db)

# Configuring app for the test environment
app.config.from_object('collector.api.config.Testing')
app.config.from_envvar('COLLECTOR_SETTINGS', silent=True)
init_logger()


class BaseTest(TestCase):

    def setUp(self):
        self.client = app.test_client()

    def post(self, url, data):
        return self.client.post(url, data=json.dumps(data),
                                content_type='application/json')

    def patch(self, url, data):
        return self.client.patch(url, data=json.dumps(data),
                                 content_type='application/json')
コード例 #5
0
ファイル: app_test.py プロジェクト: katepimenova/fuel-stats
#    Copyright 2014 Mirantis, Inc.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

from collector.api.app import app
from collector.api.config import index_filtering_rules
from collector.api import log


app.config.from_object('collector.api.config.Testing')
app.config.from_envvar('COLLECTOR_SETTINGS', silent=True)
index_filtering_rules(app)
log.init_logger()
コード例 #6
0
from flask import json
import flask_migrate
import os
from unittest2.case import TestCase

from collector.api.app import app
from collector.api.app import db
from collector.api.log import init_logger


flask_migrate.Migrate(app, db)

# Configuring app for the test environment
app.config.from_object('collector.api.config.Testing')
init_logger()


class BaseTest(TestCase):

    def setUp(self):
        self.client = app.test_client()

    def post(self, url, data):
        return self.client.post(url, data=json.dumps(data),
                                content_type='application/json')

    def patch(self, url, data):
        return self.client.patch(url, data=json.dumps(data),
                                 content_type='application/json')

    def put(self, url, data):