@@ -0,0 +1,2138 @@
+import pytest%0A%0Afrom adhocracy4.dashboard.components import DashboardComponents%0A%0A%0Adef test_register(dashboard_test_component_factory):%0A    project_component0 = dashboard_test_component_factory(%0A        weight=0, identifier='b')%0A    project_component1 = dashboard_test_component_factory(%0A        weight=0, identifier='a')%0A    module_component = dashboard_test_component_factory(identifier='c')%0A%0A    components = DashboardComponents()%0A    components.register_project(project_component0)%0A    components.register_project(project_component1)%0A    components.register_module(module_component)%0A%0A    assert components.projects == %7B'b': project_component0,%0A                                   'a': project_component1%7D%0A    assert components.modules == %7B'c': module_component%7D%0A%0A    assert components.get_project_components() == %5Bproject_component1,%0A                                                   project_component0%5D%0A    assert components.get_module_components() == %5Bmodule_component%5D%0A%0A%0Adef test_register_unique_id(dashboard_test_component):%0A    components = DashboardComponents()%0A%0A    components.register_project(dashboard_test_component)%0A    with pytest.raises(ValueError):%0A        components.register_project(dashboard_test_component)%0A%0A    components.register_module(dashboard_test_component)%0A    with pytest.raises(ValueError):%0A        components.register_module(dashboard_test_component)%0A%0A%0Adef test_urls(dashboard_test_component_factory):%0A    def fake_view(**args):%0A        pass%0A%0A    project_component = dashboard_test_component_factory(%0A        urls=%5B('%5Epc-url-pattern$', fake_view, 'pc-url')%5D)%0A    module_component = dashboard_test_component_factory(%0A        urls=%5B('%5Emc-url-pattern$', fake_view, 'mc-url')%5D)%0A%0A    components = DashboardComponents()%0A    components.register_project(project_component)%0A    components.register_module(module_component)%0A%0A    urlpatterns = components.get_urls()%0A    assert len(urlpatterns) == 2%0A%0A    assert any(map(lambda urlpattern: urlpattern.resolve('pc-url-pattern'),%0A                   urlpatterns))%0A    assert any(map(lambda urlpattern: urlpattern.resolve('mc-url-pattern'),%0A                   urlpatterns))%0A

Add DashboardComponents tests