Add get default payment acct helper

This commit is contained in:
ghubstan 2020-09-22 22:08:01 -03:00
parent e63a6c5771
commit 92f36ed03a
No known key found for this signature in database
GPG key ID: E35592D6800A861E

View file

@ -20,16 +20,25 @@ package bisq.apitest.method;
import bisq.proto.grpc.CreatePaymentAccountRequest;
import bisq.proto.grpc.GetBalanceRequest;
import bisq.proto.grpc.GetFundingAddressesRequest;
import bisq.proto.grpc.GetPaymentAccountsRequest;
import bisq.proto.grpc.LockWalletRequest;
import bisq.proto.grpc.RegisterDisputeAgentRequest;
import bisq.proto.grpc.RemoveWalletPasswordRequest;
import bisq.proto.grpc.SetWalletPasswordRequest;
import bisq.proto.grpc.UnlockWalletRequest;
import protobuf.PaymentAccount;
import java.util.stream.Collectors;
import org.junit.jupiter.api.Assertions;
import static bisq.common.app.DevEnv.DEV_PRIVILEGE_PRIV_KEY;
import static bisq.core.payment.payload.PaymentMethod.PERFECT_MONEY;
import static bisq.core.support.dispute.agent.DisputeAgent.DisputeAgentType.MEDIATOR;
import static bisq.core.support.dispute.agent.DisputeAgent.DisputeAgentType.REFUNDAGENT;
import static java.util.Comparator.comparing;
import static org.junit.jupiter.api.Assertions.*;
@ -107,6 +116,18 @@ public class MethodTest extends ApiTestCase {
.build();
}
protected final PaymentAccount getDefaultPerfectDummyPaymentAccount(BisqAppConfig bisqAppConfig) {
var getPaymentAccountsRequest = GetPaymentAccountsRequest.newBuilder().build();
var paymentAccountsService = grpcStubs(bisqAppConfig).paymentAccountsService;
PaymentAccount paymentAccount = paymentAccountsService.getPaymentAccounts(getPaymentAccountsRequest)
.getPaymentAccountsList()
.stream()
.sorted(comparing(protobuf.PaymentAccount::getCreationDate))
.collect(Collectors.toList()).get(0);
assertEquals("PerfectMoney dummy", paymentAccount.getAccountName());
return paymentAccount;
}
// Static conveniences for test methods and test case fixture setups.
protected static RegisterDisputeAgentRequest createRegisterDisputeAgentRequest(String disputeAgentType) {