diff options
Diffstat (limited to 'src/testing')
| -rw-r--r-- | src/testing/test_exchange_api.c | 58 | ||||
| -rw-r--r-- | src/testing/testing_api_cmd_withdraw.c | 32 | 
2 files changed, 54 insertions, 36 deletions
| diff --git a/src/testing/test_exchange_api.c b/src/testing/test_exchange_api.c index 29a3e5c6..ba293d4b 100644 --- a/src/testing/test_exchange_api.c +++ b/src/testing/test_exchange_api.c @@ -413,49 +413,49 @@ run (void *cls,      /**       * Move money to the exchange's bank account.       */ -    CMD_TRANSFER_TO_EXCHANGE ("create-reserve-1", +    CMD_TRANSFER_TO_EXCHANGE ("create-reserve-cs-1",                                "EUR:6.02"), -    TALER_TESTING_cmd_check_bank_admin_transfer ("check-create-reserve-1", +    TALER_TESTING_cmd_check_bank_admin_transfer ("check-create-reserve-cs-1",                                                   "EUR:6.02",                                                   bc.user42_payto,                                                   bc.exchange_payto, -                                                 "create-reserve-1"), +                                                 "create-reserve-cs-1"),      /**       * Make a reserve exist, according to the previous       * transfer.       */ -    CMD_EXEC_WIREWATCH ("wirewatch-1"), +    CMD_EXEC_WIREWATCH ("wirewatch-cs-1"),      /**       * Withdraw EUR:5.       */      TALER_TESTING_cmd_withdraw_cs_amount ("withdraw-cs-coin-1", -                                          "create-reserve-1", +                                          "create-reserve-cs-1",                                            "EUR:5",                                            MHD_HTTP_OK), -    // TODO: rest of the tests -    // /** -    //  * Withdraw EUR:1 using the SAME private coin key as for the previous coin -    //  * (in violation of the specification, to be detected on spending!). -    //  */ -    // TALER_TESTING_cmd_withdraw_amount_reuse_key ("withdraw-coin-1x", -    //                                              "create-reserve-1", -    //                                              "EUR:1", -    //                                              "withdraw-coin-1", -    //                                              MHD_HTTP_OK), -    // /** -    //  * Check the reserve is depleted. -    //  */ -    // TALER_TESTING_cmd_status ("status-1", -    //                           "create-reserve-1", -    //                           "EUR:0", -    //                           MHD_HTTP_OK), -    // /* -    //  * Try to overdraw. -    //  */ -    // TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-2", -    //                                    "create-reserve-1", -    //                                    "EUR:5", -    //                                    MHD_HTTP_CONFLICT), +    /** +     * Withdraw EUR:1 using the SAME private coin key as for the previous coin +     * (in violation of the specification, to be detected on spending!). +     */ +    TALER_TESTING_cmd_withdraw_cs_amount_reuse_key ("withdraw-cs-coin-1x", +                                                    "create-reserve-cs-1", +                                                    "EUR:1", +                                                    "withdraw-cs-coin-1", +                                                    MHD_HTTP_OK), +    /** +     * Check the reserve is depleted. +     */ +    TALER_TESTING_cmd_status ("status-cs-1", +                              "create-reserve-cs-1", +                              "EUR:0", +                              MHD_HTTP_OK), +    /* +     * Try to overdraw. +     */ +    TALER_TESTING_cmd_withdraw_cs_amount ("withdraw-cs-coin-2", +                                          "create-reserve-cs-1", +                                          "EUR:5", +                                          MHD_HTTP_CONFLICT), +    // TODO: add test for nonce reuse      TALER_TESTING_cmd_end ()    }; diff --git a/src/testing/testing_api_cmd_withdraw.c b/src/testing/testing_api_cmd_withdraw.c index e07eac34..2a98765f 100644 --- a/src/testing/testing_api_cmd_withdraw.c +++ b/src/testing/testing_api_cmd_withdraw.c @@ -266,13 +266,6 @@ reserve_withdraw_cb (void *cls,    switch (wr->hr.http_status)    {    case MHD_HTTP_OK: -    // TODO: remove -    // temporary make test successful when CS -    if (TALER_DENOMINATION_CS == ws->cipher) -    { -      break; -    } -      TALER_denom_sig_deep_copy (&ws->sig,                                 &wr->details.success.sig);      if (0 != ws->total_backoff.rel_value_us) @@ -661,6 +654,8 @@ TALER_TESTING_cmd_withdraw_amount_reuse_key (    const char *coin_ref,    unsigned int expected_response_code)  { +  // TODO: ATM this is hardcoded to RSA denominations +  // (use TALER_TESTING_cmd_withdraw_cs_amount for Clause Schnorr)    struct TALER_TESTING_Command cmd;    cmd = TALER_TESTING_cmd_withdraw_amount (label, @@ -676,6 +671,29 @@ TALER_TESTING_cmd_withdraw_amount_reuse_key (  } +struct TALER_TESTING_Command +TALER_TESTING_cmd_withdraw_cs_amount_reuse_key ( +  const char *label, +  const char *reserve_reference, +  const char *amount, +  const char *coin_ref, +  unsigned int expected_response_code) +{ +  struct TALER_TESTING_Command cmd; + +  cmd = TALER_TESTING_cmd_withdraw_cs_amount (label, +                                              reserve_reference, +                                              amount, +                                              expected_response_code); +  { +    struct WithdrawState *ws = cmd.cls; + +    ws->reuse_coin_key_ref = coin_ref; +  } +  return cmd; +} + +  /**   * Create withdraw command, letting the caller specify the   * amount by a denomination key. | 
