aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_truth_solve.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_truth_solve.c')
-rw-r--r--src/testing/testing_api_cmd_truth_solve.c58
1 files changed, 25 insertions, 33 deletions
diff --git a/src/testing/testing_api_cmd_truth_solve.c b/src/testing/testing_api_cmd_truth_solve.c
index 5c12b3f..1a935eb 100644
--- a/src/testing/testing_api_cmd_truth_solve.c
+++ b/src/testing/testing_api_cmd_truth_solve.c
@@ -127,14 +127,8 @@ truth_solve_cb (void *cls,
127 ksls->tso = NULL; 127 ksls->tso = NULL;
128 if (tsr->http_status != ksls->expected_http_status) 128 if (tsr->http_status != ksls->expected_http_status)
129 { 129 {
130 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 130 TALER_TESTING_unexpected_status (ksls->is,
131 "Unexpected response code %u to command %s in %s:%u\n", 131 tsr->http_status);
132 tsr->http_status,
133 ksls->is->commands[ksls->is->ip].label,
134 __FILE__,
135 __LINE__);
136 TALER_TESTING_interpreter_fail (ksls->is);
137 return;
138 } 132 }
139 switch (tsr->http_status) 133 switch (tsr->http_status)
140 { 134 {
@@ -163,7 +157,7 @@ truth_solve_run (void *cls,
163 const struct ANASTASIS_CRYPTO_TruthKeyP *truth_key; 157 const struct ANASTASIS_CRYPTO_TruthKeyP *truth_key;
164 const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid; 158 const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid;
165 const struct ANASTASIS_PaymentSecretP *payment_secret; 159 const struct ANASTASIS_PaymentSecretP *payment_secret;
166 const char **answerp; 160 const char *answer;
167 161
168 ksls->is = is; 162 ksls->is = is;
169 if (NULL == ksls->upload_reference) 163 if (NULL == ksls->upload_reference)
@@ -185,7 +179,7 @@ truth_solve_run (void *cls,
185 return; 179 return;
186 } 180 }
187 { 181 {
188 const char **fn; 182 const char *fn;
189 183
190 if (GNUNET_OK != 184 if (GNUNET_OK !=
191 ANASTASIS_TESTING_get_trait_filename (upload_cmd, 185 ANASTASIS_TESTING_get_trait_filename (upload_cmd,
@@ -195,8 +189,8 @@ truth_solve_run (void *cls,
195 TALER_TESTING_interpreter_fail (ksls->is); 189 TALER_TESTING_interpreter_fail (ksls->is);
196 return; 190 return;
197 } 191 }
198 if (NULL != *fn) 192 if (NULL != fn)
199 ksls->filename = GNUNET_strdup (*fn); 193 ksls->filename = GNUNET_strdup (fn);
200 } 194 }
201 if (GNUNET_OK != 195 if (GNUNET_OK !=
202 ANASTASIS_TESTING_get_trait_truth_uuid (upload_cmd, 196 ANASTASIS_TESTING_get_trait_truth_uuid (upload_cmd,
@@ -242,13 +236,13 @@ truth_solve_run (void *cls,
242 } 236 }
243 if (GNUNET_OK != 237 if (GNUNET_OK !=
244 ANASTASIS_TESTING_get_trait_code (download_cmd, 238 ANASTASIS_TESTING_get_trait_code (download_cmd,
245 &answerp)) 239 &answer))
246 { 240 {
247 GNUNET_break (0); 241 GNUNET_break (0);
248 TALER_TESTING_interpreter_fail (ksls->is); 242 TALER_TESTING_interpreter_fail (ksls->is);
249 return; 243 return;
250 } 244 }
251 if (NULL == *answerp) 245 if (NULL == answer)
252 { 246 {
253 GNUNET_break (0); 247 GNUNET_break (0);
254 TALER_TESTING_interpreter_fail (ksls->is); 248 TALER_TESTING_interpreter_fail (ksls->is);
@@ -258,9 +252,9 @@ truth_solve_run (void *cls,
258 else 252 else
259 { 253 {
260 /* answer is the answer */ 254 /* answer is the answer */
261 answerp = &ksls->answer; 255 answer = ksls->answer;
262 } 256 }
263 if (NULL == answerp) 257 if (NULL == answer)
264 { 258 {
265 GNUNET_break (0); 259 GNUNET_break (0);
266 TALER_TESTING_interpreter_fail (ksls->is); 260 TALER_TESTING_interpreter_fail (ksls->is);
@@ -291,18 +285,19 @@ truth_solve_run (void *cls,
291 { 285 {
292 struct GNUNET_HashCode h_answer; 286 struct GNUNET_HashCode h_answer;
293 287
294 GNUNET_CRYPTO_hash (*answerp, 288 GNUNET_CRYPTO_hash (answer,
295 strlen (*answerp), 289 strlen (answer),
296 &h_answer); 290 &h_answer);
297 ksls->tso = ANASTASIS_truth_solve (is->ctx, 291 ksls->tso = ANASTASIS_truth_solve (
298 ksls->anastasis_url, 292 TALER_TESTING_interpreter_get_context (is),
299 truth_uuid, 293 ksls->anastasis_url,
300 truth_key, 294 truth_uuid,
301 payment_secret, 295 truth_key,
302 GNUNET_TIME_UNIT_ZERO, 296 payment_secret,
303 &h_answer, 297 GNUNET_TIME_UNIT_ZERO,
304 &truth_solve_cb, 298 &h_answer,
305 ksls); 299 &truth_solve_cb,
300 ksls);
306 } 301 }
307 if (NULL == ksls->tso) 302 if (NULL == ksls->tso)
308 { 303 {
@@ -356,12 +351,9 @@ truth_solve_traits (void *cls,
356 struct TALER_TESTING_Trait traits[] = { 351 struct TALER_TESTING_Trait traits[] = {
357 ANASTASIS_TESTING_make_trait_payment_secret ( 352 ANASTASIS_TESTING_make_trait_payment_secret (
358 &ksls->payment_secret_response), 353 &ksls->payment_secret_response),
359 TALER_TESTING_make_trait_payto_uri ( 354 TALER_TESTING_make_trait_payto_uri (ksls->pay_uri),
360 (const char **) ksls->pay_uri), 355 TALER_TESTING_make_trait_order_id (ksls->order_id),
361 TALER_TESTING_make_trait_order_id ( 356 ANASTASIS_TESTING_make_trait_code (ksls->code),
362 (const char **) &ksls->order_id),
363 ANASTASIS_TESTING_make_trait_code (
364 (const char **) &ksls->code),
365 TALER_TESTING_trait_end () 357 TALER_TESTING_trait_end ()
366 }; 358 };
367 359