Ejemplo n.º 1
0
    def test2_process_source(self):
        my_app = create_app()
        image_storage = ImageStorage(my_app)

        for ext in _IMAGE_EXTENSIONS:
            file = FileStorage(filename='test.%s' % ext)
            result = image_storage.process_source(file)
            self.assertIsInstance(result, list)
Ejemplo n.º 2
0
    def test1_process_source(self):
        cwd = os.getcwd()
        test_zip = open(cwd + '/tests/test_imgs.zip')
        file = FileStorage(stream=test_zip, filename='test.zip')

        my_app = create_app()
        image_storage = ImageStorage(my_app)
        result = image_storage.process_source(file)

        self.assertIsInstance(result, types.GeneratorType)
Ejemplo n.º 3
0
    def setUp(self):
        """Define test variables and initialize app."""
        self.app = create_app(config_name='testing')
        self.app.register_blueprint(blueprint)
        self.app.app_context().push()
        self.client = self.app.test_client
        self.user = {'username': '******', 'email': '*****@*****.**'}

        # binds the app to the current context
        with self.app.app_context():
            # create all tables
            db.create_all()
Ejemplo n.º 4
0
    def setUp(self):
        test_settings = test_sets

        my_app = create_app(test_settings)

        client = MongoClient(my_app.config['MONGO_HOST'],
                             my_app.config['MONGO_PORT'])

        self.db = client[my_app.config['MONGO_DBNAME']]

        self.app = my_app.test_client()
        self.config = my_app.config
Ejemplo n.º 5
0
def app():
    app = create_app()
    yield app
Ejemplo n.º 6
0
import os
import unittest
import json
import sys
from dotenv import load_dotenv

sys.path.insert(0, os.path.dirname(os.getcwd()))

from api.main import create_app
from api.extensions import db

FLASKR = create_app("testing")

TEAM_DATA = dict(team_name="teamname1", role="images")

PROJECT_DATA = dict(project_name="name1", project_description="description")

USER_DATA = dict(name="name1",
                 email="*****@*****.**",
                 username="******",
                 password1="test1credentials",
                 password2="test1credentials",
                 name2="name2",
                 email2="*****@*****.**",
                 username2="user2")

project_id = ""
team_id = ""


class Test_Project(unittest.TestCase):
Ejemplo n.º 7
0
from api.main import create_app

app = create_app()
Ejemplo n.º 8
0
# manage.py
import os
import unittest

from werkzeug.utils import cached_property
from flask_script import Manager  # class for handling a set of commands
from flask_migrate import Migrate, MigrateCommand
from api.main import db, create_app
from api import blueprint

config_name = os.getenv('APP_SETTINGS')
if os.getenv('APP_SETTINGS') is None:
    config_name = 'development'

app = create_app(config_name=os.getenv('APP_SETTINGS'))
app.register_blueprint(blueprint)
app.app_context().push()

migrate = Migrate(app, db)
manager = Manager(app)

manager.add_command('db', MigrateCommand)


@manager.command
def run():
    app.run(host='0.0.0.0')


@manager.command
def test():
Ejemplo n.º 9
0
Archivo: wsgi.py Proyecto: JanGross/ctf
from api import main
app = main.create_app()
Ejemplo n.º 10
0
import os
from dotenv import load_dotenv
from flask import render_template

import sys
sys.path.insert(0,os.getcwd())
dotenv_path = os.path.join(os.path.dirname(__file__), ".env")

if os.path.exists(dotenv_path):
    load_dotenv(dotenv_path)
    
from api.main import create_app

app = create_app(os.getenv("FLASK_CONFIG") or "default")

@app.route("/", defaults={"path": ""})
@app.route("/<path:path>")
def default_route(path):
    return render_template('index.html')


if __name__ == "__main__":
    app.run(host="0.0.0.0", port=5000)
Ejemplo n.º 11
0
from api import main
from api.config import DevConfig

app = main.create_app(config_object=DevConfig)

if __name__ == '__main__':
    app.run()
Ejemplo n.º 12
0
def create_my_app():
    return create_app()
Ejemplo n.º 13
0
import logging
from logging.config import dictConfig

import uvicorn

from logging_config import LOGGING_CONFIG, LOG_LEVEL
from api.main import create_app
from api.config import API_CONFIG

dictConfig(LOGGING_CONFIG)

liturgi_format_converter_api = create_app(LOG_LEVEL == logging.DEBUG)

if __name__ == '__main__':
    uvicorn.run(liturgi_format_converter_api,
                host=API_CONFIG['hostname'],
                port=API_CONFIG['port'])
Ejemplo n.º 14
0
import os
import unittest

from flask_script import Manager

from api import blueprint
from api.main import create_app
from lib.crawler import Crawler

app = create_app(os.getenv("BOILERPLATE_ENV") or "dev")
app.register_blueprint(blueprint)
app.app_context().push()

manager = Manager(app)


@manager.command
def run():
    app.run()


@manager.command
def crawl(collection):
    Crawler.crawl_and_save_articles_and_keywords(collection)


@manager.command
def test():
    """Runs the unit tests."""
    tests = unittest.TestLoader().discover("app/test", pattern="test*.py")
    result = unittest.TextTestRunner(verbosity=2).run(tests)
Ejemplo n.º 15
0
 def test3_validate(self):
     my_app = create_app()
     image_storage = ImageStorage(my_app)
     image_storage.app.config['_UPLOAD_DIRECTORY'] = None
     self.assertRaises(KeyError, image_storage.validate)
Ejemplo n.º 16
0
import os
from logging import FileHandler, Formatter

import logging
from flask_script import Manager

from api.main import create_app

app = create_app(os.getenv('BOILERPLATE_ENV') or 'dev')

app.app_context().push()

manager = Manager(app)


@manager.command
def run():
    file_handler = FileHandler('app.log')
    file_handler.setLevel(logging.DEBUG)
    file_handler.setFormatter(
        Formatter('%(asctime)s %(levelname)s : %(message)s'))
    app.logger.addHandler(file_handler)
    app.run()


if __name__ == '__main__':
    manager.run()