commit f55c48d16d5f6e58e60fa79fa5721b2e2d8c1487
parent db5834df598e4ea4635872700f801cc6b720934a
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Tue, 13 Jan 2026 08:00:50 +0900
expand test to cover money pot patching (#10862), fix SQL
Diffstat:
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/backenddb/pg_update_money_pot.c b/src/backenddb/pg_update_money_pot.c
@@ -75,8 +75,8 @@ TMH_PG_update_money_pot (
"update_money_pot",
"SELECT"
" out_conflict_name AS conflict_name"
- " out_conflict_total AS conflict_total"
- " out_not_found AS not_found"
+ ",out_conflict_total AS conflict_total"
+ ",out_not_found AS not_found"
" FROM merchant_do_update_money_pot"
"($1,$2,$3,$4,$5,$6);");
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
diff --git a/src/backenddb/pg_update_money_pot.sql b/src/backenddb/pg_update_money_pot.sql
@@ -50,7 +50,7 @@ BEGIN
UPDATE merchant_money_pots SET
money_pot_name=in_name
,money_pot_description=in_description
- ,pot_totals=COALESCE(in_new_totals, pot_total)
+ ,pot_totals=COALESCE(in_new_totals, pot_totals)
WHERE merchant_serial=my_merchant_id
AND money_pot_serial=in_money_pot_serial
AND ( (in_old_totals IS NULL) OR (pot_totals=in_old_totals) );
diff --git a/src/testing/test_merchant_statistics.sh b/src/testing/test_merchant_statistics.sh
@@ -214,6 +214,18 @@ fi
echo "OK"
+echo -n "Patching money pot ..."
+STATUS=$(curl "http://localhost:9966/private/pots/$MONEY_POT" -X PATCH \
+ -d '{"description":"Updated pot","expected_pot_totals":[],"new_pot_totals":["KUDOS:23"],"pot_name":"#1p"}' \
+ -w "%{http_code}" -s -o "$LAST_RESPONSE")
+
+if [ "$STATUS" != "204" ]
+then
+ cat "$LAST_RESPONSE" >&2
+ exit_fail "Expected 204, pot updated. got: $STATUS"
+fi
+echo "OK"
+
echo -n "Schedule periodic report..."
STATUS=$(curl 'http://localhost:9966/private/reports' \
-d '{"description":"My report","program_section":"file","mime_type":"application/pdf","data_source":"/private/statistics-report/transactions","target_address":"'"${TMPDIR:-/tmp}/last-report"'","report_frequency":{"d_us" : 50000000}}' \