3
0
Fork 0

feat: basic support for WSGI app, views, templates

also docs + tests for what we have so far
This commit is contained in:
Lance Edgar 2024-07-12 00:17:15 -05:00
commit 977c196f47
49 changed files with 2805 additions and 0 deletions

50
tests/test_app.py Normal file
View file

@ -0,0 +1,50 @@
# -*- coding: utf-8; -*-
from unittest import TestCase
from wuttjamaican.testing import FileConfigTestCase
from pyramid.config import Configurator
from pyramid.router import Router
from wuttaweb import app as mod
class TestMakeWuttaConfig(FileConfigTestCase):
def test_config_path_required(self):
# settings must define config path, else error
settings = {}
self.assertRaises(ValueError, mod.make_wutta_config, settings)
def test_basic(self):
# mock path to config file
myconf = self.write_file('my.conf', '')
settings = {'wutta.config': myconf}
# can make a config okay
config = mod.make_wutta_config(settings)
# and that config is also stored in settings
self.assertIn('wutta_config', settings)
self.assertIs(settings['wutta_config'], config)
class TestMakePyramidConfig(TestCase):
def test_basic(self):
settings = {}
config = mod.make_pyramid_config(settings)
self.assertIsInstance(config, Configurator)
class TestMain(FileConfigTestCase):
def test_basic(self):
global_config = None
myconf = self.write_file('my.conf', '')
settings = {'wutta.config': myconf}
app = mod.main(global_config, **settings)
self.assertIsInstance(app, Router)