Mark unit and integration tests
authorKarl O. Pinc <kop@karlpinc.com>
Tue, 24 Nov 2020 18:07:40 +0000 (12:07 -0600)
committerKarl O. Pinc <kop@karlpinc.com>
Tue, 24 Nov 2020 18:07:40 +0000 (12:07 -0600)
tests/test_check_settings.py
tests/test_menu.py
tests/test_pgwui_menu.py

index 6160807d99365516edeadeb2d55b3b12a5ec887a..8626dda9d401387d391eaf945acfccd9fac3e797 100644 (file)
@@ -19,6 +19,8 @@
 
 # Karl O. Pinc <kop@karlpinc.com>
 
+import pytest
+
 import pgwui_menu.check_settings as check_settings
 
 from pgwui_common import checkset
@@ -53,6 +55,7 @@ mock_boolean_settings = testing.make_mock_fixture(
 
 # validate_order
 
+@pytest.mark.unittest
 def test_validate_order_nosetting():
     '''No error is delivered when there's no setting'''
     errors = []
@@ -61,6 +64,7 @@ def test_validate_order_nosetting():
     assert errors == []
 
 
+@pytest.mark.unittest
 def test_validate_order_ok():
     '''No errors when all components in the ordering are ok
     '''
@@ -71,6 +75,7 @@ def test_validate_order_ok():
     assert errors == []
 
 
+@pytest.mark.unittest
 def test_validate_order_singleton():
     '''A non-list as an ordering gets the right error
     '''
@@ -82,6 +87,7 @@ def test_validate_order_singleton():
     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
     '''
@@ -101,6 +107,7 @@ mock_validate_order = testing.make_mock_fixture(
 
 # check_settings()
 
+@pytest.mark.unittest
 def test_check_settings(mock_unknown_settings,
                         mock_require_settings,
                         mock_boolean_settings,
index 4eb2f9405b2e0510664e08675259ffe8d2075001..a5f44d619e5c368e22ebcb9b3ac7e1e1be1ef4bd 100644 (file)
@@ -19,6 +19,8 @@
 
 # Karl O. Pinc <kop@karlpinc.com>
 
+import pytest
+
 import copy
 import pyramid.testing
 
@@ -39,6 +41,7 @@ mock_route_url = testing.instance_method_mock_fixture('route_url')
 
 # build_menu()
 
+@pytest.mark.unittest
 def test_build_menu_no_component():
     '''When the plugin has no setting the menu is not modified
     '''
@@ -48,6 +51,7 @@ def test_build_menu_no_component():
     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
@@ -68,6 +72,7 @@ def test_build_menu_component_with_route(mock_route_url):
     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
     '''
@@ -92,6 +97,7 @@ mock_build_menu = testing.make_mock_fixture(
 
 # 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
@@ -119,6 +125,7 @@ def test_build_menu_items_component_no_plugin_conf(mock_build_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
     '''
@@ -148,6 +155,7 @@ mock_build_menu_items = testing.make_mock_fixture(
 
 # menu_view()
 
+@pytest.mark.unittest
 def test_menu_view(pyramid_config,
                    mock_find_pgwui_components,
                    mock_build_menu_items):
index 3a4ef761bad8601ee9a54a70a9ad999834b9a924..d17f894dea91c90c5facf6344d6f3676958c3051 100644 (file)
@@ -19,6 +19,8 @@
 
 # Karl O. Pinc <kop@karlpinc.com>
 
+import pytest
+
 import pyramid.config
 import pgwui_menu.pgwui_menu as pgwui_menu
 
@@ -29,6 +31,7 @@ from pgwui_testing import testing
 
 # init_menu()
 
+@pytest.mark.unittest
 def test_init_menu():
     '''A menu_label is set
     '''
@@ -47,6 +50,7 @@ mock_add_route = testing.instance_method_mock_fixture('add_route')
 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
@@ -65,6 +69,7 @@ def test_includeme(
 
 # Integration tests
 
+@pytest.mark.integrationtest
 def test_includeme_integration():
     config = pyramid.config.Configurator()
     pgwui_menu.includeme(config)