aboutsummaryrefslogtreecommitdiff
path: root/tests/test_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_core.c')
-rw-r--r--tests/test_core.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_core.c b/tests/test_core.c
index 66f8207..6520d4b 100644
--- a/tests/test_core.c
+++ b/tests/test_core.c
@@ -919,6 +919,8 @@ int main(void)
g_session, (int)org_id, (long long)att_id));
CHECK_OK(d);
CHECK(yyjson_arr_size(jget(d, "result.attachment_ids")) == 1);
+ int64_t rent_id = jint(d, "result.id");
+ CHECK(rent_id > 0);
yyjson_doc_free(d);
d = call(reqf("{\"v\":1,\"id\":\"61\",\"cmd\":\"attachment.list\","
@@ -996,6 +998,25 @@ int main(void)
CHECK_STR(d, "error.code", "NOT_FOUND");
yyjson_doc_free(d);
+ /* listing by voucher returns every linked attachment, with that voucher */
+ d = call(reqf("{\"v\":1,\"id\":\"61j\",\"cmd\":\"attachment.list\","
+ "\"session\":\"%s\",\"org\":%d,\"args\":{\"voucher_id\":%lld}}",
+ g_session, (int)org_id, (long long)rent_id));
+ CHECK_OK(d);
+ CHECK(yyjson_arr_size(jget(d, "result.items")) == 1);
+ CHECK(jint(d, "result.items.0.id") == att_id);
+ CHECK(jint(d, "result.items.0.voucher_id") == rent_id);
+ yyjson_doc_free(d);
+
+ d = call(reqf("{\"v\":1,\"id\":\"61k\",\"cmd\":\"attachment.list\","
+ "\"session\":\"%s\",\"org\":%d,\"args\":{\"voucher_id\":%lld}}",
+ g_session, (int)org_id, (long long)sale_id));
+ CHECK_OK(d);
+ CHECK(yyjson_arr_size(jget(d, "result.items")) == 1);
+ CHECK(jint(d, "result.items.0.id") == att_id);
+ CHECK(jint(d, "result.items.0.voucher_id") == sale_id);
+ yyjson_doc_free(d);
+
/* voucher.list reports the attachment count */
d = call(reqf("{\"v\":1,\"id\":\"61i\",\"cmd\":\"voucher.list\","
"\"session\":\"%s\",\"org\":%d,\"args\":{\"limit\":5}}",