Skip to content

Commit

Permalink
LoggingCQLClient.disconnect implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Manish Tomar committed Dec 27, 2013
1 parent a1f38f4 commit b522c58
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions silverberg/logger.py
Expand Up @@ -51,3 +51,9 @@ def record_time(result):
return result

return self._client.execute(query, args, consistency).addBoth(record_time)

def disconnect(self):
"""
See :py:func:`silverberg.client.CQLClient.disconnect`
"""
return self._client.disconnect()
11 changes: 10 additions & 1 deletion silverberg/test/test_logger.py
Expand Up @@ -31,7 +31,7 @@ def setUp(self):
"""
Mock CQLClient and log instance
"""
self.client = mock.Mock(spec=['execute'])
self.client = mock.Mock(spec=['execute', 'disconnect'])
self.log = mock.Mock(spec=['msg'])
self.clock = Clock()
self.logclient = LoggingCQLClient(self.client, self.log, self.clock)
Expand Down Expand Up @@ -71,3 +71,12 @@ def _execute(*args):
seconds_taken=10)
_, kwargs = self.log.msg.call_args
self.assertEqual(kwargs['reason'].value, err)

def test_disconnect(self):
"""
logclient.disconnect() calls internal client's disconnect()
"""
self.client.disconnect.return_value = 'result'
d = self.logclient.disconnect()
self.client.disconnect.assert_called_once_with()
self.assertEquals(d, 'result')

0 comments on commit b522c58

Please sign in to comment.