fix: add WuttaDateWidget
and associated logic
This commit is contained in:
parent
e3c432aa37
commit
9e0e36d536
4 changed files with 103 additions and 7 deletions
|
@ -3,6 +3,8 @@
|
|||
from unittest import TestCase
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
import colander
|
||||
import deform
|
||||
from pyramid import testing
|
||||
|
@ -188,6 +190,18 @@ class TestForm(TestCase):
|
|||
self.assertIn('created', form.widgets)
|
||||
self.assertIsInstance(form.widgets['created'], MyWidget)
|
||||
|
||||
# mock up a table with all relevant column types
|
||||
class Whatever(model.Base):
|
||||
__tablename__ = 'whatever'
|
||||
id = sa.Column(sa.Integer(), primary_key=True)
|
||||
date = sa.Column(sa.Date())
|
||||
date_time = sa.Column(sa.DateTime())
|
||||
|
||||
# widget set for all known types
|
||||
form = self.make_form(model_class=Whatever)
|
||||
self.assertIsInstance(form.widgets['date'], widgets.WuttaDateWidget)
|
||||
self.assertIsInstance(form.widgets['date_time'], widgets.WuttaDateTimeWidget)
|
||||
|
||||
def test_set_grid(self):
|
||||
form = self.make_form(fields=['foo', 'bar'])
|
||||
self.assertNotIn('foo', form.widgets)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue