mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-22 19:49:32 +00:00
re-enable testStartEditOfferForActiveOffer()
This commit is contained in:
parent
8985f84d77
commit
b077d532fa
2 changed files with 14 additions and 16 deletions
|
@ -557,17 +557,17 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||||
ResultHandler resultHandler,
|
ResultHandler resultHandler,
|
||||||
ErrorMessageHandler errorMessageHandler) {
|
ErrorMessageHandler errorMessageHandler) {
|
||||||
Offer offer = openOffer.getOffer();
|
Offer offer = openOffer.getOffer();
|
||||||
if (openOffer.isScheduled()) {
|
if (openOffer.isAvailable()) {
|
||||||
resultHandler.handleResult(); // ignore if scheduled
|
|
||||||
} else {
|
|
||||||
offerBookService.deactivateOffer(offer.getOfferPayload(),
|
offerBookService.deactivateOffer(offer.getOfferPayload(),
|
||||||
() -> {
|
() -> {
|
||||||
openOffer.setState(OpenOffer.State.DEACTIVATED);
|
openOffer.setState(OpenOffer.State.DEACTIVATED);
|
||||||
requestPersistence();
|
requestPersistence();
|
||||||
log.debug("deactivateOpenOffer, offerId={}", offer.getId());
|
log.debug("deactivateOpenOffer, offerId={}", offer.getId());
|
||||||
resultHandler.handleResult();
|
resultHandler.handleResult();
|
||||||
},
|
},
|
||||||
errorMessageHandler);
|
errorMessageHandler);
|
||||||
|
} else {
|
||||||
|
resultHandler.handleResult(); // ignore if unavailable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -598,15 +598,15 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||||
|
|
||||||
offersToBeEdited.put(openOffer.getId(), openOffer);
|
offersToBeEdited.put(openOffer.getId(), openOffer);
|
||||||
|
|
||||||
if (openOffer.isDeactivated()) {
|
if (openOffer.isAvailable()) {
|
||||||
resultHandler.handleResult();
|
|
||||||
} else {
|
|
||||||
deactivateOpenOffer(openOffer,
|
deactivateOpenOffer(openOffer,
|
||||||
resultHandler,
|
resultHandler,
|
||||||
errorMessage -> {
|
errorMessage -> {
|
||||||
offersToBeEdited.remove(openOffer.getId());
|
offersToBeEdited.remove(openOffer.getId());
|
||||||
errorMessageHandler.handleErrorMessage(errorMessage);
|
errorMessageHandler.handleErrorMessage(errorMessage);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
resultHandler.handleResult();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ import haveno.network.p2p.P2PService;
|
||||||
import haveno.network.p2p.peers.PeerManager;
|
import haveno.network.p2p.peers.PeerManager;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
@ -51,7 +50,6 @@ public class OpenOfferManagerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Disabled // TODO: re-enable when editing offers supported
|
|
||||||
public void testStartEditOfferForActiveOffer() {
|
public void testStartEditOfferForActiveOffer() {
|
||||||
P2PService p2PService = mock(P2PService.class);
|
P2PService p2PService = mock(P2PService.class);
|
||||||
OfferBookService offerBookService = mock(OfferBookService.class);
|
OfferBookService offerBookService = mock(OfferBookService.class);
|
||||||
|
@ -89,6 +87,7 @@ public class OpenOfferManagerTest {
|
||||||
}).when(offerBookService).deactivateOffer(any(OfferPayload.class), any(ResultHandler.class), any(ErrorMessageHandler.class));
|
}).when(offerBookService).deactivateOffer(any(OfferPayload.class), any(ResultHandler.class), any(ErrorMessageHandler.class));
|
||||||
|
|
||||||
final OpenOffer openOffer = new OpenOffer(make(btcUsdOffer));
|
final OpenOffer openOffer = new OpenOffer(make(btcUsdOffer));
|
||||||
|
openOffer.setState(OpenOffer.State.AVAILABLE);
|
||||||
|
|
||||||
ResultHandler resultHandler = () -> startEditOfferSuccessful.set(true);
|
ResultHandler resultHandler = () -> startEditOfferSuccessful.set(true);
|
||||||
|
|
||||||
|
@ -97,7 +96,6 @@ public class OpenOfferManagerTest {
|
||||||
verify(offerBookService, times(1)).deactivateOffer(any(OfferPayload.class), any(ResultHandler.class), any(ErrorMessageHandler.class));
|
verify(offerBookService, times(1)).deactivateOffer(any(OfferPayload.class), any(ResultHandler.class), any(ErrorMessageHandler.class));
|
||||||
|
|
||||||
assertTrue(startEditOfferSuccessful.get());
|
assertTrue(startEditOfferSuccessful.get());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in a new issue