summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-11-29 14:23:15 +0100
committerChristian Grothoff <christian@grothoff.org>2019-11-29 14:23:15 +0100
commite653b0ae8a90856a6792cd754a054314a0d7d355 (patch)
treebde2343389701f5bb79415f7871ed22695459158 /src/include
parent911b311691b599e1a148fd629d6fe682ab9ccc04 (diff)
downloadsync-e653b0ae8a90856a6792cd754a054314a0d7d355.tar.gz
sync-e653b0ae8a90856a6792cd754a054314a0d7d355.tar.bz2
sync-e653b0ae8a90856a6792cd754a054314a0d7d355.zip
add traits, finish download cmd
Diffstat (limited to 'src/include')
-rw-r--r--src/include/sync_testing_lib.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/src/include/sync_testing_lib.h b/src/include/sync_testing_lib.h
index 2fd32c1..8bb11af 100644
--- a/src/include/sync_testing_lib.h
+++ b/src/include/sync_testing_lib.h
@@ -26,8 +26,100 @@
#include "sync_service.h"
#include <gnunet/gnunet_json_lib.h>
+#include <taler/taler_testing_lib.h>
#include <microhttpd.h>
+/**
+ * Index used in #SYNC_TESTING_get_trait_hash() for the current hash.
+ */
+#define SYNC_TESTING_TRAIT_HASH_CURRENT 0
+
+/**
+ * Index used in #SYNC_TESTING_get_trait_hash() for the previous hash.
+ */
+#define SYNC_TESTING_TRAIT_HASH_PREVIOUS 1
+
+
+/**
+ * Obtain a hash from @a cmd.
+ *
+ * @param cmd command to extract the number from.
+ * @param index the number's index number, #SYNC_TESTING_TRAIT_HASH_CURRENT or
+ * #SYNC_TESTING_TRAIT_HASH_PREVIOUS
+ * @param h[out] set to the hash 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);
+
+
+/**
+ * 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
+TALER_TESTING_make_trait_hash (unsigned int index,
+ const struct GNUNET_HashCode *h);
+
+
+/**
+ * Obtain an account public key from @a cmd.
+ *
+ * @param cmd command to extract the public key from.
+ * @param index usually 0
+ * @param pub[out] set to the account public key used in @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);
+
+
+/**
+ * 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
+TALER_TESTING_make_trait_account_pub (unsigned int index,
+ const struct SYNC_AccountPublicKeyP *h);
+
+
+/**
+ * Obtain an account private key from @a cmd.
+ *
+ * @param cmd command to extract the number from.
+ * @param index must be 0
+ * @param priv[out] set to the account private key used in @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);
+
+
+/**
+ * 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
+TALER_TESTING_make_trait_account_priv (unsigned int index,
+ const struct
+ SYNC_AccountPrivateKeyP *priv);
+
/**
* Start the sync backend process. Assume the port
@@ -57,6 +149,19 @@ TALER_TESTING_prepare_sync (const char *config_filename);
/**
+ * Make the "backup download" command for a non-existent upload.
+ *
+ * @param label command label
+ * @param sync_url base URL of the sync serving
+ * the policy store request.
+ * @return the command
+ */
+struct TALER_TESTING_Command
+SYNC_TESTING_cmd_backup_nx (const char *label,
+ const char *sync_url);
+
+
+/**
* Make the "backup download" command.
*
* @param label command label
@@ -71,4 +176,5 @@ SYNC_TESTING_cmd_backup_download (const char *label,
const char *sync_url,
unsigned int http_status,
const char *upload_ref);
+
#endif