def setUp(self): super(TestOctaviaV2Driver, self).setUp() self.context = utils.dummy_context() self.conn_params = self.context.to_dict() self.conn = mock.Mock() with mock.patch.object(sdk, 'create_connection') as mock_creare_conn: mock_creare_conn.return_value = self.conn self.oc = octavia_v2.OctaviaClient(self.context)
def oc(self): """Octavia client :return: octavia client """ if self._oc: return self._oc self._oc = octaviaclient.OctaviaClient(self.conn_params) return self._oc
def test_init(self, mock_create_connection): params = self.conn_params octavia_v2.OctaviaClient(params) mock_create_connection.assert_called_once_with(params)