feat: basic support for WSGI app, views, templates
also docs + tests for what we have so far
This commit is contained in:
commit
977c196f47
49 changed files with 2805 additions and 0 deletions
50
tests/test_app.py
Normal file
50
tests/test_app.py
Normal 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)
|
Loading…
Add table
Add a link
Reference in a new issue