from wtforms import Form, BooleanField, StringField, validators
from zephyros import controller


class FooForm(Form):
    username = StringField(
        label='Username',
        validators=[validators.Length(min=4, max=25)],
        description='First name and Last name',
        default='Ivan Ivanowsky'
    )
    accept_rules = BooleanField('I accept the site rules',
                                [validators.input_required])


def test_controller_describe_fields():
    ctrl = controller.WTFormController(FooForm)
    fields = ctrl.describe_fields()

    assert len(fields) == 2
    assert fields[0] == dict(
        name='username', fullname='Username',
        require=False, type='text',
        attrs={}, default='Ivan Ivanowsky',
        widget={'type': 'input', 'attrs': {}},
        description='First name and Last name',
        validators=[{'type': 'length', 'attrs': {'min': 4, 'max': 25}}]
    )


def test_controller_describe_form():
    ctrl = controller.WTFormController(FooForm)
@@ -340,16 +340,31 @@
 anField(
+%0A        label=
 'I accep
@@ -394,32 +394,19 @@
     
-                        
+validators=
 %5Bval
@@ -428,16 +428,21 @@
 equired%5D
+%0A    
 )%0A%0A%0Adef 
@@ -910,32 +910,310 @@
 x': 25%7D%7D%5D%0A    )%0A
+    assert fields%5B1%5D == dict(%0A        name='accept_rules', fullname='I accept the site rules',%0A        require=True, type='bool',%0A        attrs=%7B%7D, default='Ivan Ivanowsky',%0A        widget=%7B'type': 'checkbox', 'attrs': %7B%7D%7D,%0A        description=None,%0A        validators=%5B%5D%0A    )%0A
 %0A%0Adef test_contr

add new tests