# Karl O. Pinc <kop@karlpinc.com>
+import pytest
+
import pgwui_menu.check_settings as check_settings
from pgwui_common import checkset
# validate_order
+@pytest.mark.unittest
def test_validate_order_nosetting():
'''No error is delivered when there's no setting'''
errors = []
assert errors == []
+@pytest.mark.unittest
def test_validate_order_ok():
'''No errors when all components in the ordering are ok
'''
assert errors == []
+@pytest.mark.unittest
def test_validate_order_singleton():
'''A non-list as an ordering gets the right error
'''
assert isinstance(errors[0], menu_ex.BadOrderValuesError)
+@pytest.mark.unittest
def test_validate_order_bad_component():
'''Deliver error when a bad component name is supplied in the ordering
'''
# check_settings()
+@pytest.mark.unittest
def test_check_settings(mock_unknown_settings,
mock_require_settings,
mock_boolean_settings,
# Karl O. Pinc <kop@karlpinc.com>
+import pytest
+
import copy
import pyramid.testing
# build_menu()
+@pytest.mark.unittest
def test_build_menu_no_component():
'''When the plugin has no setting the menu is not modified
'''
assert menu_items == []
+@pytest.mark.unittest
def test_build_menu_component_with_route(mock_route_url):
'''When the plugin has a setting and a route the route is
returned with the label
assert menu_items == [(test_plugin, test_route, plugin_settings)]
+@pytest.mark.unittest
def test_build_menu_component_no_route(mock_route_url):
'''When the plugin has a setting and no route, the menu is not modified
'''
# build_menu_items()
+@pytest.mark.unittest
def test_build_menu_items_component_no_plugin_conf(mock_build_menu):
'''Components given in the pgwui_menu.order setting are added
in order, other components are added alphabetically, the pgwui_menu
assert call_args[3][0][3] == 'plugin4'
+@pytest.mark.unittest
def test_build_menu_items_no_order(mock_build_menu):
'''When there is no order setting components are added alphabetically
'''
# menu_view()
+@pytest.mark.unittest
def test_menu_view(pyramid_config,
mock_find_pgwui_components,
mock_build_menu_items):
# Karl O. Pinc <kop@karlpinc.com>
+import pytest
+
import pyramid.config
import pgwui_menu.pgwui_menu as pgwui_menu
# init_menu()
+@pytest.mark.unittest
def test_init_menu():
'''A menu_label is set
'''
mock_scan = testing.instance_method_mock_fixture('scan')
+@pytest.mark.unittest
def test_includeme(
mock_init_menu, mock_add_static_view, mock_add_route, mock_scan):
'''add_static_view, add_route, and scan are all called
# Integration tests
+@pytest.mark.integrationtest
def test_includeme_integration():
config = pyramid.config.Configurator()
pgwui_menu.includeme(config)