##// END OF EJS Templates
Adds configuration options to use Google Drive content manager...
Adds configuration options to use Google Drive content manager Adds the key contentmanager_js_source to webapp_settings that allows for specifying the content manager JavaScript source file. Also adds a NotebookManager subclass, ClientSideNotebookManager, which does minimal logic. This class is used when the JavaScript content manager doesn't use the Python notebook manager, but rather implements that logic client side, as is the case for the Google Drive based content manager. A sample command line that uses the Google Drive content manager, and the ClientSideNotebookManager, is ipython notebook --NotebookApp.webapp_settings="{'contentmanager_js_source': 'base/js/drive_contentmanager'}" --NotebookApp.notebook_manager_class="IPython.html.services.notebooks.clientsidenbmanager.ClientSideNotebookManager"

File last commit:

r18547:4043b271
r18639:28c27a69
Show More
test_events.py
32 lines | 929 B | text/x-python | PythonLexer
Thomas Kluyver
Add tests for callback infrastructure
r15601 import unittest
try: # Python 3.3 +
from unittest.mock import Mock
except ImportError:
from mock import Mock
Thomas Kluyver
Rename callbacks -> events (mostly), fire -> trigger
r15605 from IPython.core import events
Thomas Kluyver
Add tests for callback infrastructure
r15601 import IPython.testing.tools as tt
def ping_received():
pass
class CallbackTests(unittest.TestCase):
def setUp(self):
Thomas Kluyver
Rename callbacks -> events (mostly), fire -> trigger
r15605 self.em = events.EventManager(get_ipython(), {'ping_received': ping_received})
Thomas Kluyver
Add tests for callback infrastructure
r15601
def test_register_unregister(self):
cb = Mock()
Thomas Kluyver
Rename callbacks -> events (mostly), fire -> trigger
r15605 self.em.register('ping_received', cb)
self.em.trigger('ping_received')
Thomas Kluyver
Add tests for callback infrastructure
r15601 self.assertEqual(cb.call_count, 1)
Thomas Kluyver
Rename callbacks -> events (mostly), fire -> trigger
r15605 self.em.unregister('ping_received', cb)
self.em.trigger('ping_received')
Thomas Kluyver
Add tests for callback infrastructure
r15601 self.assertEqual(cb.call_count, 1)
def test_cb_error(self):
cb = Mock(side_effect=ValueError)
Thomas Kluyver
Rename callbacks -> events (mostly), fire -> trigger
r15605 self.em.register('ping_received', cb)
Thomas Kluyver
Add tests for callback infrastructure
r15601 with tt.AssertPrints("Error in callback"):
Nathaniel J. Smith
Remove EventManager reset methods, because they violate encapsulation....
r18547 self.em.trigger('ping_received')