[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: harness: complete scenario te
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: harness: complete scenario test for coin acceptor |
Date: |
Wed, 08 Jan 2025 14:55:59 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new dfe4e8a6c harness: complete scenario test for coin acceptor
dfe4e8a6c is described below
commit dfe4e8a6c3dfe0ced087db871bfaac768d135947
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Jan 8 14:55:56 2025 +0100
harness: complete scenario test for coin acceptor
---
packages/taler-harness/src/index.ts | 40 +++++++++++++++++++++++++++----------
1 file changed, 29 insertions(+), 11 deletions(-)
diff --git a/packages/taler-harness/src/index.ts
b/packages/taler-harness/src/index.ts
index d7da5fc61..109784c74 100644
--- a/packages/taler-harness/src/index.ts
+++ b/packages/taler-harness/src/index.ts
@@ -50,6 +50,7 @@ import {
stringifyPayTemplateUri,
} from "@gnu-taler/taler-util";
import { clk } from "@gnu-taler/taler-util/clk";
+import { readlinePrompt } from "@gnu-taler/taler-util/compat";
import {
HttpResponse,
createPlatformHttpLib,
@@ -132,7 +133,6 @@ testingCli
const httpLib = createPlatformHttpLib();
const bankUrl = "https://bank.test.taler.net/";
const bank = new TalerCoreBankHttpClient(bankUrl, httpLib);
- const bankAuth = new TalerAuthenticationHttpClient(bankUrl, httpLib);
const username = "user-" + encodeCrock(getRandomBytes(10)).toLowerCase();
const password = "pw-" + encodeCrock(getRandomBytes(10)).toLowerCase();
@@ -146,25 +146,43 @@ testingCli
logger.info(
`Created test bank account ${username} with password ${password}`,
);
- const tokRes = await bankAuth.createAccessTokenBasic(username, password, {
+ const tokRes = await bank.createAccessTokenBasic(username, password, {
scope: "readwrite",
});
narrowOpSuccessOrThrow("token", tokRes);
const token = tokRes.body.access_token;
+ const bankAuth = { username, token };
logger.info(`Test account access token ${token}`);
- const createWithdrawalResp = await bank.createWithdrawal(
- {
- username,
- token,
- },
- {
- no_amount_to_wallet: true,
- },
- );
+ const createWithdrawalResp = await bank.createWithdrawal(bankAuth, {
+ no_amount_to_wallet: true,
+ });
narrowOpSuccessOrThrow("create-withdrawal", createWithdrawalResp);
logger.info(
`Created withdrawal operation
${createWithdrawalResp.body.taler_withdraw_uri}`,
);
+ const wopid = createWithdrawalResp.body.withdrawal_id;
+ while (true) {
+ logger.info(`Waiting for status change.`);
+ const statusRes = await bank.getWithdrawalById(wopid, {
+ timeoutMs: 30000,
+ old_state: "pending",
+ });
+ narrowOpSuccessOrThrow("getWithdrawalById", statusRes);
+ logger.info(`Withdrawal status: ${j2s(statusRes.body.status)}`);
+ if (statusRes.body.status === "selected") {
+ break;
+ }
+ }
+ const amountStr = await readlinePrompt("Amount to withdraw: ");
+ const confirmRes = await bank.confirmWithdrawalById(
+ bankAuth,
+ {
+ amount: amountStr as AmountString,
+ },
+ wopid,
+ );
+ narrowOpSuccessOrThrow("confirmWithdrawalById", confirmRes);
+ logger.info("Withdrawal operation confirmed");
});
const advancedCli = talerHarnessCli.subcommand("advancedArgs", "advanced", {
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: harness: complete scenario test for coin acceptor,
gnunet <=