Пример #1
0
def test_widget_rendering(field, value):
    class TestForm(forms.Form):
        test = field
    result = TestForm(dict(test=value))['test'].to_html()
    test.assert_equals_fixture(
        f'test_widget_{type(field).__name__}_{value}',
        result,
    )
Пример #2
0
 def test_mdc_top_app_bar(self):
     c = MdcTopAppBar(
         Text("Page title"),
         action_items=[
             ('more_vert', 'Options', '#'),
         ],
     )
     test.assert_equals_fixture('test_mdc_top_app_bar', c.to_html())
Пример #3
0
def test_form_post():
    result = ExampleForm(dict(
        char='',
        email='[email protected]',
        datetime_0='11/11/2020',
        datetime_1='aoeu',
        textarea='example textarea value',
    )).to_html()
    test.assert_equals_fixture('test_form_post', result)
Пример #4
0
 def test_mdc_drawer(self):
     c = MdcDrawer(
         MdcDrawerHeader(
             drawer_title="Title",
             drawer_subtitle="subtitle",
         ),
         MdcNavList(
             MdcListItem(
                 Text("Home"),
                 icon='home',
                 href='#',
                 active=True,
             ), ))
     test.assert_equals_fixture('test_mdc_drawer', c.to_html())
Пример #5
0
 def test_mdc_app_content(self):
     c = MdcAppContent(Text('Content'))
     test.assert_equals_fixture('test_mdc_app_content', c.to_html())
Пример #6
0
def test_form_to_component_override():
    class TestForm(ExampleForm):
        def to_component(self):
            return html.CList(self['char'], self['datetime'])
    result = TestForm().to_html()
    test.assert_equals_fixture('test_form_override', result)
Пример #7
0
def test_view_get(client):
    result = client.get('/').content.decode('utf8')
    test.assert_equals_fixture('test_form_get', result)