44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
# -*- coding: utf-8; -*-
|
|
|
|
import sqlalchemy as sa
|
|
|
|
from wuttjamaican.testing import DataTestCase
|
|
|
|
from asgiref.wsgi import WsgiToAsgi
|
|
from pyramid.router import Router
|
|
|
|
from wutta_corepos.web.db import CoreOpSession
|
|
|
|
from sideshow_corepos.web import app as mod
|
|
|
|
|
|
class TestMain(DataTestCase):
|
|
|
|
def test_basic(self):
|
|
global_config = None
|
|
settings = {'wutta_config': self.config}
|
|
app = mod.main(global_config, **settings)
|
|
self.assertIsInstance(app, Router)
|
|
self.assertIsNone(CoreOpSession.session_factory.kw['bind'])
|
|
|
|
def test_corepos_engine(self):
|
|
engine = sa.create_engine('sqlite://')
|
|
self.config.core_office_op_engine = engine
|
|
settings = {'wutta_config': self.config}
|
|
app = mod.main(None, **settings)
|
|
self.assertIsInstance(app, Router)
|
|
self.assertIs(CoreOpSession.session_factory.kw['bind'], engine)
|
|
|
|
|
|
class TestMakeWsgiApp(DataTestCase):
|
|
|
|
def test_basic(self):
|
|
wsgi = mod.make_wsgi_app(config=self.config)
|
|
self.assertIsInstance(wsgi, Router)
|
|
|
|
|
|
class TestMakeAsgiApp(DataTestCase):
|
|
|
|
def test_basic(self):
|
|
asgi = mod.make_asgi_app(config=self.config)
|
|
self.assertIsInstance(asgi, WsgiToAsgi)
|