mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-22 11:39:29 +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,
|
||||
ErrorMessageHandler errorMessageHandler) {
|
||||
Offer offer = openOffer.getOffer();
|
||||
if (openOffer.isScheduled()) {
|
||||
resultHandler.handleResult(); // ignore if scheduled
|
||||
} else {
|
||||
if (openOffer.isAvailable()) {
|
||||
offerBookService.deactivateOffer(offer.getOfferPayload(),
|
||||
() -> {
|
||||
openOffer.setState(OpenOffer.State.DEACTIVATED);
|
||||
requestPersistence();
|
||||
log.debug("deactivateOpenOffer, offerId={}", offer.getId());
|
||||
resultHandler.handleResult();
|
||||
},
|
||||
errorMessageHandler);
|
||||
() -> {
|
||||
openOffer.setState(OpenOffer.State.DEACTIVATED);
|
||||
requestPersistence();
|
||||
log.debug("deactivateOpenOffer, offerId={}", offer.getId());
|
||||
resultHandler.handleResult();
|
||||
},
|
||||
errorMessageHandler);
|
||||
} else {
|
||||
resultHandler.handleResult(); // ignore if unavailable
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -598,15 +598,15 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||
|
||||
offersToBeEdited.put(openOffer.getId(), openOffer);
|
||||
|
||||
if (openOffer.isDeactivated()) {
|
||||
resultHandler.handleResult();
|
||||
} else {
|
||||
if (openOffer.isAvailable()) {
|
||||
deactivateOpenOffer(openOffer,
|
||||
resultHandler,
|
||||
errorMessage -> {
|
||||
offersToBeEdited.remove(openOffer.getId());
|
||||
errorMessageHandler.handleErrorMessage(errorMessage);
|
||||
});
|
||||
} else {
|
||||
resultHandler.handleResult();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import haveno.network.p2p.P2PService;
|
|||
import haveno.network.p2p.peers.PeerManager;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.nio.file.Files;
|
||||
|
@ -51,7 +50,6 @@ public class OpenOfferManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO: re-enable when editing offers supported
|
||||
public void testStartEditOfferForActiveOffer() {
|
||||
P2PService p2PService = mock(P2PService.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));
|
||||
|
||||
final OpenOffer openOffer = new OpenOffer(make(btcUsdOffer));
|
||||
openOffer.setState(OpenOffer.State.AVAILABLE);
|
||||
|
||||
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));
|
||||
|
||||
assertTrue(startEditOfferSuccessful.get());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in a new issue