Exemplo n.º 1
0
 async def get_application(self):
     app = get_application()
     app[SETTINGS] = TestSettings
     app[NON_WORKING_DAYS] = {self.MIN_DATE, self.MAX_DATE, *self.WEEKENDS}
     app[ALLOWED_DATE_MIN] = min(app[NON_WORKING_DAYS])
     app[ALLOWED_DATE_MAX] = max(app[NON_WORKING_DAYS])
     return app
Exemplo n.º 2
0
def app() -> Generator[FastAPI, Any, None]:
    """
    Create a fresh database on each test case.
    """
    Base.metadata.create_all(engine)  # Create the tables.
    _app = get_application()
    yield _app
    Base.metadata.drop_all(engine)
Exemplo n.º 3
0
    def setUp(self):

        #clears existing data
        from google.appengine.ext import db
        from google.appengine.ext import testbed
        from google.appengine.api import apiproxy_stub_map

        # First, create an instance of the Testbed class.
        self.testbed = testbed.Testbed()
        # Then activate the testbed, which prepares the service stubs for use.
        self.testbed.activate()
        # Next, declare which service stubs you want to use.
        self.testbed.init_datastore_v3_stub()

        self.testbed.init_taskqueue_stub(root_path = www_root)
        self.testbed.init_memcache_stub()

        self.app = RestifyMiddleware(get_application(), Member, 'member')
        self.app = TestApp(self.app, extra_environ = dict(HTTP_HOST='localhost:8080'))
Exemplo n.º 4
0
    def setUp(self):

        #clears existing data
        from google.appengine.ext import db
        from google.appengine.ext import testbed
        from google.appengine.api import apiproxy_stub_map

        # First, create an instance of the Testbed class.
        self.testbed = testbed.Testbed()
        # Then activate the testbed, which prepares the service stubs for use.
        self.testbed.activate()
        # Next, declare which service stubs you want to use.
        self.testbed.init_datastore_v3_stub()

        self.testbed.init_taskqueue_stub(root_path=www_root)
        self.testbed.init_memcache_stub()

        self.app = RestifyMiddleware(get_application(), Member, 'member')
        self.app = TestApp(self.app,
                           extra_environ=dict(HTTP_HOST='localhost:8080'))
Exemplo n.º 5
0
from aiohttp import web

import main

if __name__ == '__main__':
    app = main.get_application()
    web.run_app(app)
Exemplo n.º 6
0
 def get_app(self, loop):
     app = main.get_application(loop)
     return app
Exemplo n.º 7
0
def app() -> FastAPI:
    from main import get_application

    the_app = get_application()
    return the_app
Exemplo n.º 8
0
def client(loop, aiohttp_client):
    app = loop.run_until_complete(get_application())
    return loop.run_until_complete(aiohttp_client(app))
Exemplo n.º 9
0
from fastapi.testclient import TestClient
from main import get_application

api = get_application()

test_client = TestClient(api)


def test_status_route_root():
    response = test_client.get("/status")
    assert response.status_code == 200