def _test_add_floating_ip(self, ri, fip, is_failure=False):
    if (not is_failure):
        ri.floating_ip_added_dist = mock.Mock(return_value=lib_constants.FLOATINGIP_STATUS_ACTIVE)
    else:
        ri.floating_ip_added_dist = mock.Mock(return_value=lib_constants.FLOATINGIP_STATUS_ERROR)
    result = ri.add_floating_ip(fip, mock.sentinel.interface_name, mock.sentinel.device)
    ri.floating_ip_added_dist.assert_called_once_with(fip, mock.ANY)
    return result
def _test_add_floating_ip(self, ri, fip, is_failure=False):
    if (not is_failure):
        ri.floating_ip_added_dist = mock.Mock(return_value=lib_constants.FLOATINGIP_STATUS_ACTIVE)
    else:
        ri.floating_ip_added_dist = mock.Mock(return_value=lib_constants.FLOATINGIP_STATUS_ERROR)
    result = ri.add_floating_ip(fip, mock.sentinel.interface_name, mock.sentinel.device)
    ri.floating_ip_added_dist.assert_called_once_with(fip, mock.ANY)
    return result