def test_load_ordered(ordered_server_extensions):
    app = ServerApp()
    app.jpserver_extensions = OrderedDict([('mockextension2', True),
                                           ('mockextension1', True)])

    app.init_server_extensions()

    assert app.mockII is True, "Mock II should have been loaded"
    assert app.mockI is True, "Mock I should have been loaded"
    assert app.mock_shared == 'II', "Mock II should be loaded after Mock I"
Example #2
0
    def test_merge_config(self):
        # enabled at sys level
        mock_sys = self._inject_mock_extension('mockext_sys')
        # enabled at sys, disabled at user
        mock_both = self._inject_mock_extension('mockext_both')
        # enabled at user
        mock_user = self._inject_mock_extension('mockext_user')
        # enabled at Python
        mock_py = self._inject_mock_extension('mockext_py')

        toggle_serverextension_python('mockext_sys', enabled=True, user=False)
        toggle_serverextension_python('mockext_user', enabled=True, user=True)
        toggle_serverextension_python('mockext_both', enabled=True, user=False)
        toggle_serverextension_python('mockext_both', enabled=False, user=True)

        app = ServerApp(jpserver_extensions={'mockext_py': True})
        app.init_server_extensions()

        assert mock_user.loaded
        assert mock_sys.loaded
        assert mock_py.loaded
        assert not mock_both.loaded