Add placement get exception ut
Unit test for placement client get exception Change-Id: Iae32a9676ac08f5f88721ad493e6cbc8b96e27a9
This commit is contained in:
parent
ac4fb544a3
commit
5c504ec9a8
@ -15,6 +15,7 @@
|
|||||||
import fixtures
|
import fixtures
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
from cyborg.common import exception
|
||||||
from cyborg.common import placement_client
|
from cyborg.common import placement_client
|
||||||
from cyborg.tests import base
|
from cyborg.tests import base
|
||||||
|
|
||||||
@ -39,3 +40,10 @@ class PlacementAPITest(base.TestCase):
|
|||||||
placement.get(mock.Mock())
|
placement.get(mock.Mock())
|
||||||
msg = 'Successfully get resources from placement: %s'
|
msg = 'Successfully get resources from placement: %s'
|
||||||
self.mock_log_debug.assert_called_once_with(msg, mock.ANY)
|
self.mock_log_debug.assert_called_once_with(msg, mock.ANY)
|
||||||
|
|
||||||
|
def test_get_exception(self):
|
||||||
|
placement = placement_client.PlacementClient()
|
||||||
|
mock_ret = mock.Mock(status_code=500)
|
||||||
|
self.mock_sdk.get.return_value = mock_ret
|
||||||
|
self.assertRaises(exception.PlacementServerError,
|
||||||
|
placement.get, mock.Mock())
|
||||||
|
Loading…
Reference in New Issue
Block a user