diff options
Diffstat (limited to 'src/testing/testing_api_cmd_policy_lookup.c')
-rw-r--r-- | src/testing/testing_api_cmd_policy_lookup.c | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/src/testing/testing_api_cmd_policy_lookup.c b/src/testing/testing_api_cmd_policy_lookup.c index eaff0f2..2d854c5 100644 --- a/src/testing/testing_api_cmd_policy_lookup.c +++ b/src/testing/testing_api_cmd_policy_lookup.c @@ -3,14 +3,14 @@ Copyright (C) 2020 Anastasis SARL Anastasis is free software; you can redistribute it and/or modify it under the - terms of the GNU Lesser General Public License as published by the Free Software + terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. Anastasis is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with + You should have received a copy of the GNU General Public License along with Anastasis; see the file COPYING.GPL. If not, see <http://www.gnu.org/licenses/> */ /** @@ -72,32 +72,26 @@ struct PolicyLookupState * Function called with the results of a #ANASTASIS_policy_lookup(). * * @param cls closure - * @param http_status HTTP status of the request * @param dd details about the lookup operation */ static void policy_lookup_cb (void *cls, - unsigned int http_status, const struct ANASTASIS_DownloadDetails *dd) { struct PolicyLookupState *pls = cls; pls->plo = NULL; - if (http_status != pls->http_status) + if (dd->http_status != pls->http_status) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected response code %u to command %s in %s:%u\n", - http_status, - pls->is->commands[pls->is->ip].label, - __FILE__, - __LINE__); - TALER_TESTING_interpreter_fail (pls->is); + TALER_TESTING_unexpected_status (pls->is, + dd->http_status, + pls->http_status); return; } if (NULL != pls->upload_reference) { - if ( (MHD_HTTP_OK == http_status) && - (0 != GNUNET_memcmp (&dd->curr_policy_hash, + if ( (MHD_HTTP_OK == dd->http_status) && + (0 != GNUNET_memcmp (&dd->details.ok.curr_policy_hash, pls->upload_hash)) ) { GNUNET_break (0); @@ -140,7 +134,6 @@ policy_lookup_run (void *cls, } if (GNUNET_OK != ANASTASIS_TESTING_get_trait_hash (upload_cmd, - ANASTASIS_TESTING_TRAIT_HASH_CURRENT, &pls->upload_hash)) { GNUNET_break (0); @@ -149,7 +142,6 @@ policy_lookup_run (void *cls, } if (GNUNET_OK != ANASTASIS_TESTING_get_trait_account_pub (upload_cmd, - 0, &anastasis_pub)) { GNUNET_break (0); @@ -158,11 +150,12 @@ policy_lookup_run (void *cls, } pls->anastasis_pub = *anastasis_pub; } - pls->plo = ANASTASIS_policy_lookup (is->ctx, - pls->anastasis_url, - &pls->anastasis_pub, - &policy_lookup_cb, - pls); + pls->plo = ANASTASIS_policy_lookup ( + TALER_TESTING_interpreter_get_context (is), + pls->anastasis_url, + &pls->anastasis_pub, + &policy_lookup_cb, + pls); if (NULL == pls->plo) { GNUNET_break (0); |