Properly handle SVN connection/client errors.

This requires my fork of the SVN library, until pull request #43 is merged
upstream: https://github.com/dsoprea/PySvn/pull/43
This commit is contained in:
2016-08-31 16:42:21 +02:00
parent 5732b16afc
commit a89e98c556
3 changed files with 47 additions and 18 deletions

View File

@@ -9,6 +9,7 @@ import unittest
from dateutil.tz import tzutc
import mock
import svn.common
import logging_config
from attract_server import subversion
@@ -122,3 +123,18 @@ class TestCommitLogObserver(unittest.TestCase):
blinks[1])
self.assertEqual({'log_entry': SVN_LOG_BATCH_WITH_TASK_MARKERS[2], 'task_id': 'T4433'},
blinks[2])
def test_svn_error(self):
"""SVN errors should not crash the observer."""
self.mock_client.log_default = mock.Mock(name='log_default',
side_effect=svn.common.SvnCommandError('unittest'))
record_blink = mock.Mock(name='record_blink',
spec={'__name__': 'record_blink'})
subversion.task_logged.connect(record_blink)
self.observer.fetch_and_observe()
record_blink.assert_not_called()
self.mock_client.log_default.assert_called_once()