Esempio n. 1
0
    def test_notification_unsubscribe_all(self):
        """nc.unsubscribe_from_all_notifications should prevent any more calls going to the component."""
        v = ViewState(MagicMock())
        n = NotificationCentre(v)
        component = MagicMock()
        v.component_from_path = MagicMock(return_value=component)

        n.subscribe_to_notification('test_notification', 'page.test_component')
        n.subscribe_to_notification('test_notification2', 'page.test_component')
        n.unsubscribe_from_all_notifications('page.test_component')
        n.post_notification('test_notification')
        n.post_notification('test_notification2')
        self.assertEqual(component.process_notification.call_count, 0)