Further mock adjustments to deal with intermittent failure

When the py-mysql tox target is run after the py27 tox target it can
sometimes fail because a MagicMock was not properly initialized.
This change more completely fleshes out the mock so that a TypeError
does not occur when a debugging log message is caused. The
specifics of why the logging only happens sometimes are not
understood.

Change-Id: I99f80d794b757a0ac05f7a9b53974ba9913e6e68
Closes-Bug: #1438300
This commit is contained in:
Chris Dent 2015-04-02 12:53:34 +01:00
parent 65099e6aae
commit 931d7a415e

View File

@ -27,9 +27,10 @@ class TestOpencontrailClient(base.BaseTestCase):
self.get_resp = mock.MagicMock()
self.get = mock.patch('requests.get',
return_value=self.get_resp).start()
self.get_resp.raw_version = 1.1
self.get_resp.raw.version = 1.1
self.get_resp.status_code = 200
self.get_resp.reason = 'OK'
self.get_resp.content = ''
def test_vm_statistics(self):
self.client.networks.get_vm_statistics('bbb')