コード例 #1
0
def test_missing_plugin_render():
    plugin_id = printable_gibberish()
    cell = LayoutCell(plugin_identifier=plugin_id)
    assert not cell.plugin_class
    assert not cell.instantiate_plugin()
    assert ("%s?" % plugin_id) in cell.render(
        None)  # Should render a "whut?" comment
コード例 #2
0
ファイル: test_editor_forms.py プロジェクト: Jeewes/shoop
def test_formless_plugin_in_lcfg():
    with plugin_override():
        cell = LayoutCell("inject")
        assert cell.instantiate_plugin()
        lcfg = LayoutCellFormGroup(data={"general-size_md": "8"}, layout_cell=cell)
        assert "plugin" not in lcfg.forms
        assert lcfg.is_valid()
        lcfg.save()
        assert cell.sizes["md"] == 8  # Something got saved even if the plugin doesn't need config
コード例 #3
0
def test_formless_plugin_in_lcfg():
    two_thirds = int(LayoutCellGeneralInfoForm.CELL_FULL_WIDTH * 2 / 3)
    with plugin_override():
        cell = LayoutCell("inject")
        assert cell.instantiate_plugin()
        lcfg = LayoutCellFormGroup(data={"general-cell_width": "%d" % two_thirds}, layout_cell=cell)
        assert "plugin" not in lcfg.forms
        assert lcfg.is_valid()
        lcfg.save()
        assert cell.sizes["md"] == two_thirds  # Something got saved even if the plugin doesn't need config
コード例 #4
0
ファイル: test_editor_forms.py プロジェクト: krisera/shoop
def test_formless_plugin_in_lcfg():
    with plugin_override():
        cell = LayoutCell("inject")
        assert cell.instantiate_plugin()
        lcfg = LayoutCellFormGroup(data={"general-size_md": "8"},
                                   layout_cell=cell)
        assert "plugin" not in lcfg.forms
        assert lcfg.is_valid()
        lcfg.save()
        assert cell.sizes[
            "md"] == 8  # Something got saved even if the plugin doesn't need config
コード例 #5
0
def test_formless_plugin_in_lcfg():
    two_thirds = int(LayoutCellGeneralInfoForm.CELL_FULL_WIDTH * 2 / 3)
    with plugin_override():
        cell = LayoutCell("inject")
        assert cell.instantiate_plugin()
        lcfg = LayoutCellFormGroup(
            data={"general-cell_width": "%d" % two_thirds}, layout_cell=cell)
        assert "plugin" not in lcfg.forms
        assert lcfg.is_valid()
        lcfg.save()
        assert cell.sizes[
            "md"] == two_thirds  # Something got saved even if the plugin doesn't need config
コード例 #6
0
ファイル: test_editor_forms.py プロジェクト: krisera/shoop
def test_lcfg():
    with plugin_override():
        cell = LayoutCell("text", sizes={"md": 8})
        lcfg = LayoutCellFormGroup(layout_cell=cell)
        assert "general" in lcfg.forms
        assert "plugin" in lcfg.forms
        assert not lcfg.is_valid()  # Oh, we must've forgotten the text...
        lcfg = LayoutCellFormGroup(data={
            "general-size_md": "8",
            "plugin-text": "Hello, world!"
        },
                                   layout_cell=cell)
        assert lcfg.is_valid()  # Let's see now!
        lcfg.save()
        assert cell.sizes["md"] == 8
        assert cell.config["text"] == "Hello, world!"
コード例 #7
0
def test_lcfg():
    two_thirds = int(LayoutCellGeneralInfoForm.CELL_FULL_WIDTH * 2 / 3)
    with plugin_override():
        cell = LayoutCell("text", sizes={"md": two_thirds, "sm": two_thirds})
        lcfg = LayoutCellFormGroup(layout_cell=cell)
        assert "general" in lcfg.forms
        assert "plugin" in lcfg.forms
        assert not lcfg.is_valid()  # Oh, we must've forgotten the text...
        lcfg = LayoutCellFormGroup(data={
            "general-cell_width": "%d" % two_thirds,
            "plugin-text": "Hello, world!"
        },
                                   layout_cell=cell)
        assert lcfg.is_valid()  # Let's see now!
        lcfg.save()
        assert cell.sizes["md"] == two_thirds
        assert cell.config["text"] == "Hello, world!"
コード例 #8
0
ファイル: test_layout.py プロジェクト: cuberskulk/shoop
def test_null_cell_render():
    cell = LayoutCell(None)
    assert not cell.plugin_class
    assert not cell.instantiate_plugin()
    assert not cell.render(None)  # Should render nothing whatsoever!
コード例 #9
0
ファイル: test_layout.py プロジェクト: cuberskulk/shoop
def test_missing_plugin_render():
    plugin_id = printable_gibberish()
    cell = LayoutCell(plugin_identifier=plugin_id)
    assert not cell.plugin_class
    assert not cell.instantiate_plugin()
    assert ("%s?" % plugin_id) in cell.render(None)  # Should render a "whut?" comment
コード例 #10
0
ファイル: test_editor_forms.py プロジェクト: Jeewes/shoop
def test_pluginless_lcfg():
    with plugin_override():
        cell = LayoutCell(None)
        assert not cell.instantiate_plugin()
        lcfg = LayoutCellFormGroup(layout_cell=cell)
        assert "plugin" not in lcfg.forms
コード例 #11
0
ファイル: test_layout.py プロジェクト: teserak/shoop
def test_plugin_naming():
    with plugin_override():
        cell = LayoutCell(TextPlugin.identifier)
        assert cell.plugin_name == TextPlugin.name
コード例 #12
0
ファイル: test_layout.py プロジェクト: teserak/shoop
def test_null_cell_render():
    cell = LayoutCell(None)
    assert not cell.plugin_class
    assert not cell.instantiate_plugin()
    assert not cell.render(None)  # Should render nothing whatsoever!
コード例 #13
0
ファイル: test_editor_forms.py プロジェクト: krisera/shoop
def test_pluginless_lcfg():
    with plugin_override():
        cell = LayoutCell(None)
        assert not cell.instantiate_plugin()
        lcfg = LayoutCellFormGroup(layout_cell=cell)
        assert "plugin" not in lcfg.forms