Simplify the includeme() testing
authorKarl O. Pinc <kop@karlpinc.com>
Mon, 11 Mar 2024 16:40:16 +0000 (11:40 -0500)
committerKarl O. Pinc <kop@karlpinc.com>
Mon, 11 Mar 2024 16:40:16 +0000 (11:40 -0500)
src/pgwui_develop/TEMPLATE/tests/test_pgwui_TEMPLATE.py.mak

index 84ae7949edf77f022339192d1b98d21b96d3fc22..25372422d96b4da65d8b5e6118ba4b5011c769ac 100644 (file)
@@ -81,20 +81,15 @@ mock_establish_settings = testing.make_mock_fixture(
 
 # includeme()
 
-mock_add_route = testing.instance_method_mock_fixture('add_route')
-mock_scan = testing.instance_method_mock_fixture('scan')
-
+mock_testConfig = testing.make_mock_fixture(pyramid.testing.testConfig)
 
 @pytest.mark.unittest
-def test_includeme(mock_establish_settings, mock_add_route, mock_scan):
+def test_includeme(mock__settings, mock_testConfig):
     '''establish_settings, add_route, and scan are all called
     '''
-    with pyramid.testing.testConfig() as config:
-        mocked_add_route = mock_add_route(config)
-        mocked_scan = mock_scan(config)
-
+    with mock_testConfig() as config:
         ${component.lower()}.includeme(config)
+        config.establish_settings.assert_called_once()
+        config.add_route.assert_called_once()
+        config.scan.assert_called_once()
 
-    mock_establish_settings.assert_called_once()
-    mocked_add_route.assert_called_once()
-    mocked_scan.assert_called_once()