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
0
tests/views/__init__.py
Normal file
0
tests/views/__init__.py
Normal file
14
tests/views/test___init__.py
Normal file
14
tests/views/test___init__.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
|
||||
from unittest import TestCase
|
||||
|
||||
from pyramid import testing
|
||||
|
||||
|
||||
class TestIncludeMe(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
with testing.testConfig() as pyramid_config:
|
||||
|
||||
# just ensure no error happens when included..
|
||||
pyramid_config.include('wuttaweb.views')
|
21
tests/views/test_base.py
Normal file
21
tests/views/test_base.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
|
||||
from unittest import TestCase
|
||||
|
||||
from pyramid import testing
|
||||
|
||||
from wuttjamaican.conf import WuttaConfig
|
||||
from wuttaweb.views import base
|
||||
|
||||
|
||||
class TestView(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
config = WuttaConfig()
|
||||
request = testing.DummyRequest()
|
||||
request.wutta_config = config
|
||||
|
||||
view = base.View(request)
|
||||
self.assertIs(view.request, request)
|
||||
self.assertIs(view.config, config)
|
||||
self.assertIs(view.app, config.get_app())
|
27
tests/views/test_common.py
Normal file
27
tests/views/test_common.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
|
||||
from unittest import TestCase
|
||||
|
||||
from pyramid import testing
|
||||
|
||||
from wuttjamaican.conf import WuttaConfig
|
||||
from wuttaweb.views import common
|
||||
|
||||
|
||||
class TestCommonView(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.config = WuttaConfig()
|
||||
self.app = self.config.get_app()
|
||||
self.request = testing.DummyRequest()
|
||||
self.request.wutta_config = self.config
|
||||
self.pyramid_config = testing.setUp(request=self.request)
|
||||
self.pyramid_config.include('wuttaweb.views.common')
|
||||
|
||||
def tearDown(self):
|
||||
testing.tearDown()
|
||||
|
||||
def test_home(self):
|
||||
view = common.CommonView(self.request)
|
||||
context = view.home()
|
||||
self.assertEqual(context['index_title'], self.app.get_title())
|
Loading…
Add table
Add a link
Reference in a new issue