re-enable testStartEditOfferForActiveOffer()

This commit is contained in:
woodser 2023-08-19 07:07:05 -04:00
parent 8985f84d77
commit b077d532fa
2 changed files with 14 additions and 16 deletions

View File

@ -557,9 +557,7 @@ 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);
@ -568,6 +566,8 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
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();
}
}

View File

@ -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