feat: add initial/basic forms support
This commit is contained in:
parent
0604651be5
commit
95d3623a5e
16 changed files with 858 additions and 10 deletions
|
@ -3,19 +3,31 @@
|
|||
from unittest import TestCase
|
||||
|
||||
from pyramid import testing
|
||||
from pyramid.httpexceptions import HTTPFound
|
||||
|
||||
from wuttjamaican.conf import WuttaConfig
|
||||
from wuttaweb.views import base
|
||||
from wuttaweb.forms import Form
|
||||
|
||||
|
||||
class TestView(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
config = WuttaConfig()
|
||||
request = testing.DummyRequest()
|
||||
request.wutta_config = config
|
||||
def setUp(self):
|
||||
self.config = WuttaConfig()
|
||||
self.app = self.config.get_app()
|
||||
self.request = testing.DummyRequest(wutta_config=self.config)
|
||||
self.view = base.View(self.request)
|
||||
|
||||
view = base.View(request)
|
||||
self.assertIs(view.request, request)
|
||||
self.assertIs(view.config, config)
|
||||
self.assertIs(view.app, config.get_app())
|
||||
def test_basic(self):
|
||||
self.assertIs(self.view.request, self.request)
|
||||
self.assertIs(self.view.config, self.config)
|
||||
self.assertIs(self.view.app, self.app)
|
||||
|
||||
def test_make_form(self):
|
||||
form = self.view.make_form()
|
||||
self.assertIsInstance(form, Form)
|
||||
|
||||
def test_redirect(self):
|
||||
error = self.view.redirect('/')
|
||||
self.assertIsInstance(error, HTTPFound)
|
||||
self.assertEqual(error.location, '/')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue