Exemplo n.º 1
0
# -*- coding: UTF-8 -*-
from start import get_container
import os, logging

"""
This script must by the wsgi handler to start the application. 

You can customize it for your need.
"""
import sys
base = sys.path[0]
sys.path.insert(0, base + "/../../../")

debug = True

if debug:
    logging.basicConfig(level=logging.DEBUG)

parameters = {
    'ioc.debug': debug,
    'ioc.env': 'prod',
    'project.root_folder': os.path.dirname(os.path.realpath(__file__))
}

app = get_container(parameters).get("ioc.extra.flask.app")

if __name__ == '__main__':
    app.run(debug=debug,host="0.0.0.0")
Exemplo n.º 2
0
sollicitudin eget quis odio. Proin at turpis augue, a dignissim sapien. Duis eget sem sit 
amet urna hendrerit semper. Nulla facilisi. Nunc molestie facilisis tellus. Quisque eget 
volutpat magna. Integer nec facilisis est.

Etiam dapibus dui non ante imperdiet ut pharetra lorem blandit. Vivamus sit amet laoreet augue.
Pellentesque eu ipsum non nunc porttitor pharetra. Pellentesque in dui massa. Sed venenatis 
lectus id arcu sagittis pharetra. Donec porttitor justo vel arcu posuere gravida non nec est. 
Suspendisse ornare tempus sapien at fermentum. Phasellus ultrices venenatis eros sed convallis.
Nullam bibendum laoreet orci eu vestibulum. Praesent sagittis, massa sed pharetra pulvinar, 
diam dui semper lacus, vel ornare diam ipsum sit amet nunc. Pellentesque eu rutrum erat. 
Suspendisse eu scelerisque velit. Integer ac mi quam, vitae convallis lacus.

"""


container = get_container(parameters)

mongo = container.get('element.manager.mongodb')


def clean(mongo):
    print "Removing data"
    mongo.get_collection().remove()

def insert_posts(mongo):
    print "Inserting Posts"
    count = 0

    root = mongo.save(None, "core.node", {
        "parent": None,
        "slug": "blog"
Exemplo n.º 3
0
base = sys.path[0]
sys.path.insert(0, base + "/../../")
sys.path.insert(0, base + "/../../../../../")

from start import get_container

import element

parameters = {
    'ioc.debug': True,
    'ioc.env': 'prod',
    'project.root_folder': os.path.realpath(os.path.dirname(os.path.realpath(__file__)) + '/../..')
}

app = TestApp(get_container(parameters).get("ioc.extra.flask.app"))

class FunctionTest(unittest.TestCase):
    def assert_json(self, response):
        self.assertEquals(200, response.status_int)
        self.assertEquals('application/json', response.content_type)

        return self

    def test_handlers(self):
        response = app.get('/api/element/handlers.json')

        self.assert_json(response)

        self.assertEquals(13, len(response.json['results']))