def setUp(self): super(TestNeutronV2Driver, 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.nc = neutron_v2.NeutronClient(self.context)
def test_init(self, mock_create_connection): params = self.conn_params neutron_v2.NeutronClient(params) mock_create_connection.assert_called_once_with(params)
def nc(self): if self._nc: return self._nc self._nc = neutronclient.NeutronClient(self.conn_params) return self._nc