Exemple #1
0
def runserver():
    # api_health
    from api_health import app

    instance = app.create({'debug': opts.debug})
    instance.listen(opts.port)

    click.echo('Server running on port: {}'.format(opts.port))
    tornado.ioloop.IOLoop.current().start()
# -*- coding: utf-8 -*-

import json
import urllib
import responses
from tornado.testing import AsyncHTTPTestCase, gen_test

from api_health import app
from api_health.models.base import Base, engine

instance = app.create()


class TestHandlerBase(AsyncHTTPTestCase):
    def setUp(self):
        Base.metadata.create_all(engine)
        super(TestHandlerBase, self).setUp()

    def get_app(self):
        return instance

    def tearDown(self):
        super(TestHandlerBase, self).tearDown()
        Base.metadata.drop_all(engine)


class TestIntegration(TestHandlerBase):
    @responses.activate
    @gen_test
    def test_full_happy_path(self):
        headers = {'Content-Type': 'application/json; charset=UTF-8'}