summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-02-18 15:51:10 +0100
committerChristian Grothoff <christian@grothoff.org>2024-02-18 15:51:10 +0100
commitb06c4429d1ea419086b33e149b56dbf32ada3cf2 (patch)
tree360a4e86a26cf8e455fe9d344dc469ffb55b82b9 /src/testing
parent7f8aa4ae77ba01de45ea323ea4c89065577cac1b (diff)
downloadsync-b06c4429d1ea419086b33e149b56dbf32ada3cf2.tar.gz
sync-b06c4429d1ea419086b33e149b56dbf32ada3cf2.tar.bz2
sync-b06c4429d1ea419086b33e149b56dbf32ada3cf2.zip
-get rid of legacy trait style code
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/Makefile.am4
-rw-r--r--src/testing/testing_api_cmd_backup_download.c15
-rw-r--r--src/testing/testing_api_cmd_backup_upload.c38
-rw-r--r--src/testing/testing_api_trait_account_priv.c73
-rw-r--r--src/testing/testing_api_trait_account_pub.c73
-rw-r--r--src/testing/testing_api_trait_hash.c73
6 files changed, 21 insertions, 255 deletions
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index 4fafc69..2a97606 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -16,9 +16,7 @@ libsynctesting_la_SOURCES = \
testing_api_cmd_backup_download.c \
testing_api_cmd_backup_upload.c \
testing_api_helpers.c \
- testing_api_trait_account_pub.c \
- testing_api_trait_account_priv.c \
- testing_api_trait_hash.c
+ testing_api_traits.c
libsynctesting_la_LIBADD = \
$(top_builddir)/src/lib/libsync.la \
-ltalermerchant \
diff --git a/src/testing/testing_api_cmd_backup_download.c b/src/testing/testing_api_cmd_backup_download.c
index eaa1b8f..15ae376 100644
--- a/src/testing/testing_api_cmd_backup_download.c
+++ b/src/testing/testing_api_cmd_backup_download.c
@@ -149,27 +149,24 @@ backup_download_run (void *cls,
return;
}
if (GNUNET_OK !=
- SYNC_TESTING_get_trait_hash (upload_cmd,
- SYNC_TESTING_TRAIT_HASH_CURRENT,
- &bds->upload_hash))
+ TALER_TESTING_get_trait_curr_hash (upload_cmd,
+ &bds->upload_hash))
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (bds->is);
return;
}
if (GNUNET_OK !=
- SYNC_TESTING_get_trait_hash (upload_cmd,
- SYNC_TESTING_TRAIT_HASH_PREVIOUS,
- &bds->prev_upload_hash))
+ TALER_TESTING_get_trait_prev_hash (upload_cmd,
+ &bds->prev_upload_hash))
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (bds->is);
return;
}
if (GNUNET_OK !=
- SYNC_TESTING_get_trait_account_pub (upload_cmd,
- 0,
- &sync_pub))
+ TALER_TESTING_get_trait_account_pub (upload_cmd,
+ &sync_pub))
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (bds->is);
diff --git a/src/testing/testing_api_cmd_backup_upload.c b/src/testing/testing_api_cmd_backup_upload.c
index c030852..206069c 100644
--- a/src/testing/testing_api_cmd_backup_upload.c
+++ b/src/testing/testing_api_cmd_backup_upload.c
@@ -189,9 +189,8 @@ backup_upload_cb (void *cls,
bus->last_upload);
GNUNET_assert (NULL != ref);
GNUNET_assert (GNUNET_OK ==
- SYNC_TESTING_get_trait_hash (ref,
- SYNC_TESTING_TRAIT_HASH_CURRENT,
- &h));
+ TALER_TESTING_get_trait_curr_hash (ref,
+ &h));
if (0 != GNUNET_memcmp (h,
&ud->details.recovered_backup.
existing_backup_hash))
@@ -248,9 +247,8 @@ backup_upload_run (void *cls,
const struct GNUNET_HashCode *h;
if (GNUNET_OK ==
- SYNC_TESTING_get_trait_hash (ref,
- SYNC_TESTING_TRAIT_HASH_CURRENT,
- &h))
+ TALER_TESTING_get_trait_curr_hash (ref,
+ &h))
{
bus->prev_hash = *h;
}
@@ -259,9 +257,8 @@ backup_upload_run (void *cls,
const struct SYNC_AccountPrivateKeyP *priv;
if (GNUNET_OK !=
- SYNC_TESTING_get_trait_account_priv (ref,
- 0,
- &priv))
+ TALER_TESTING_get_trait_account_priv (ref,
+ &priv))
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (bus->is);
@@ -273,9 +270,8 @@ backup_upload_run (void *cls,
const struct SYNC_AccountPublicKeyP *pub;
if (GNUNET_OK !=
- SYNC_TESTING_get_trait_account_pub (ref,
- 0,
- &pub))
+ TALER_TESTING_get_trait_account_pub (ref,
+ &pub))
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (bus->is);
@@ -386,24 +382,18 @@ backup_upload_traits (void *cls,
{
struct BackupUploadState *bus = cls;
struct TALER_TESTING_Trait straits[] = {
- SYNC_TESTING_make_trait_hash (SYNC_TESTING_TRAIT_HASH_CURRENT,
- &bus->curr_hash),
- SYNC_TESTING_make_trait_hash (SYNC_TESTING_TRAIT_HASH_PREVIOUS,
- &bus->prev_hash),
+ TALER_TESTING_make_trait_curr_hash (&bus->curr_hash),
+ TALER_TESTING_make_trait_prev_hash (&bus->prev_hash),
TALER_TESTING_make_trait_claim_token (&bus->token),
- SYNC_TESTING_make_trait_account_pub (0,
- &bus->sync_pub),
- SYNC_TESTING_make_trait_account_priv (0,
- &bus->sync_priv),
+ TALER_TESTING_make_trait_account_pub (&bus->sync_pub),
+ TALER_TESTING_make_trait_account_priv (&bus->sync_priv),
TALER_TESTING_make_trait_order_id (bus->payment_order_id),
TALER_TESTING_trait_end ()
};
struct TALER_TESTING_Trait ftraits[] = {
TALER_TESTING_make_trait_claim_token (&bus->token),
- SYNC_TESTING_make_trait_account_pub (0,
- &bus->sync_pub),
- SYNC_TESTING_make_trait_account_priv (0,
- &bus->sync_priv),
+ TALER_TESTING_make_trait_account_pub (&bus->sync_pub),
+ TALER_TESTING_make_trait_account_priv (&bus->sync_priv),
TALER_TESTING_make_trait_order_id (bus->payment_order_id),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_api_trait_account_priv.c b/src/testing/testing_api_trait_account_priv.c
deleted file mode 100644
index b8bfb5b..0000000
--- a/src/testing/testing_api_trait_account_priv.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2019 Taler Systems SA
-
- TALER is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
-
- TALER 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
- General Privlic License for more details.
-
- You should have received a copy of the GNU General Privlic
- License along with TALER; see the file COPYING. If not, see
- <http://www.gnu.org/licenses/>
-*/
-/**
- * @file lib/testing_api_trait_account_priv.c
- * @brief traits to offer a account_priv
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "sync_service.h"
-#include "sync_testing_lib.h"
-
-#define SYNC_TESTING_TRAIT_ACCOUNT_PRIV "sync-account_priv"
-
-
-/**
- * Obtain an account private key from @a cmd.
- *
- * @param cmd command to extract the private key from.
- * @param index the private key's index number.
- * @param n[out] set to the private key coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-SYNC_TESTING_get_trait_account_priv
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct SYNC_AccountPrivateKeyP **priv)
-{
- return cmd->traits (cmd->cls,
- (const void **) priv,
- SYNC_TESTING_TRAIT_ACCOUNT_PRIV,
- index);
-}
-
-
-/**
- * Offer an account private key.
- *
- * @param index usually zero
- * @param priv the account_priv to offer.
- * @return #GNUNET_OK on success.
- */
-struct TALER_TESTING_Trait
-SYNC_TESTING_make_trait_account_priv
- (unsigned int index,
- const struct SYNC_AccountPrivateKeyP *priv)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = SYNC_TESTING_TRAIT_ACCOUNT_PRIV,
- .ptr = (const void *) priv
- };
- return ret;
-}
-
-
-/* end of testing_api_trait_account_priv.c */
diff --git a/src/testing/testing_api_trait_account_pub.c b/src/testing/testing_api_trait_account_pub.c
deleted file mode 100644
index 9fecb18..0000000
--- a/src/testing/testing_api_trait_account_pub.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2019 Taler Systems SA
-
- TALER is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
-
- TALER 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with TALER; see the file COPYING. If not, see
- <http://www.gnu.org/licenses/>
-*/
-/**
- * @file lib/testing_api_trait_account_pub.c
- * @brief traits to offer a account_pub
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "sync_service.h"
-#include "sync_testing_lib.h"
-
-#define SYNC_TESTING_TRAIT_ACCOUNT_PUB "sync-account_pub"
-
-
-/**
- * Obtain an account public key from @a cmd.
- *
- * @param cmd command to extract the public key from.
- * @param index the public key's index number.
- * @param n[out] set to the public key coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-SYNC_TESTING_get_trait_account_pub
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct SYNC_AccountPublicKeyP **pub)
-{
- return cmd->traits (cmd->cls,
- (const void **) pub,
- SYNC_TESTING_TRAIT_ACCOUNT_PUB,
- index);
-}
-
-
-/**
- * Offer an account public key.
- *
- * @param index usually zero
- * @param h the account_pub to offer.
- * @return #GNUNET_OK on success.
- */
-struct TALER_TESTING_Trait
-SYNC_TESTING_make_trait_account_pub
- (unsigned int index,
- const struct SYNC_AccountPublicKeyP *h)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = SYNC_TESTING_TRAIT_ACCOUNT_PUB,
- .ptr = (const void *) h
- };
- return ret;
-}
-
-
-/* end of testing_api_trait_account_pub.c */
diff --git a/src/testing/testing_api_trait_hash.c b/src/testing/testing_api_trait_hash.c
deleted file mode 100644
index 10b10d8..0000000
--- a/src/testing/testing_api_trait_hash.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2019 Taler Systems SA
-
- TALER is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
-
- TALER 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with TALER; see the file COPYING. If not, see
- <http://www.gnu.org/licenses/>
-*/
-/**
- * @file lib/testing_api_trait_hash.c
- * @brief traits to offer a hash
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "sync_service.h"
-#include "sync_testing_lib.h"
-
-#define SYNC_TESTING_TRAIT_HASH "sync-hash"
-
-
-/**
- * Obtain a hash from @a cmd.
- *
- * @param cmd command to extract the number from.
- * @param index the number's index number.
- * @param n[out] set to the number coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-SYNC_TESTING_get_trait_hash
- (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct GNUNET_HashCode **h)
-{
- return cmd->traits (cmd->cls,
- (const void **) h,
- SYNC_TESTING_TRAIT_HASH,
- index);
-}
-
-
-/**
- * Offer a hash.
- *
- * @param index the number's index number.
- * @param h the hash to offer.
- * @return #GNUNET_OK on success.
- */
-struct TALER_TESTING_Trait
-SYNC_TESTING_make_trait_hash
- (unsigned int index,
- const struct GNUNET_HashCode *h)
-{
- struct TALER_TESTING_Trait ret = {
- .index = index,
- .trait_name = SYNC_TESTING_TRAIT_HASH,
- .ptr = (const void *) h
- };
- return ret;
-}
-
-
-/* end of testing_api_trait_hash.c */