'Test the unhandled error observer'

def test_unhandled_error_observer(self):

    self.mock_endpoints()
    expected_text = ''
    def on_tribler_exception(exception_text):
        self.assertEqual(exception_text, expected_text)
    on_tribler_exception.called = 0
    self.session.lm.api_manager.root_endpoint.events_endpoint.on_tribler_exception = on_tribler_exception
    self.session.lm.api_manager.root_endpoint.state_endpoint.on_tribler_exception = on_tribler_exception
    expected_text = 'abcd'
    self.session.unhandled_error_observer({'isError': True, 'log_legacy': True, 'log_text': 'abcd'})
    expected_text = 'defg'
    self.session.unhandled_error_observer({'isError': True, 'log_failure': 'defg'})
