- update fs
[oweals/gnunet.git] / src / fs / test_fs_uri.c
index 47fa2024bc424705f66828d4a3f871eafe5d6bd6..2fc5b2a2d4649673ab82b6d2a92b3b215397ad14 100644 (file)
@@ -134,6 +134,7 @@ testLocation ()
   GNUNET_free (uric);
   if (uri2 == NULL)
   {
+    fprintf (stderr, "URI parsing failed: %s\n", emsg);
     GNUNET_break (0);
     GNUNET_FS_uri_destroy (uri);
     GNUNET_CONFIGURATION_destroy (cfg);
@@ -162,6 +163,11 @@ testNamespace (int i)
   char *uri;
   struct GNUNET_FS_Uri *ret;
   char *emsg;
+  struct GNUNET_CRYPTO_EcdsaPrivateKey *ph;
+  struct GNUNET_CRYPTO_EcdsaPublicKey id;
+  char buf[1024];
+  char ubuf[1024];
+  char *sret;
 
   if (NULL !=
       (ret =
@@ -187,11 +193,17 @@ testNamespace (int i)
     GNUNET_assert (0);
   }
   GNUNET_free (emsg);
-  ret =
-      GNUNET_FS_uri_parse
-      ("gnunet://fs/sks/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820/test",
-       &emsg);
-  if (ret == NULL)
+  ph = GNUNET_CRYPTO_ecdsa_key_create ();
+  GNUNET_CRYPTO_ecdsa_key_get_public (ph, &id);
+  sret = GNUNET_STRINGS_data_to_string (&id, sizeof (id),
+                                       ubuf, sizeof (ubuf) - 1);
+  GNUNET_assert (NULL != sret);
+  sret[0] = '\0';
+  GNUNET_snprintf (buf, sizeof (buf),
+                  "gnunet://fs/sks/%s/test",
+                  ubuf);
+  ret = GNUNET_FS_uri_parse (buf, &emsg);
+  if (NULL == ret)
   {
     GNUNET_free (emsg);
     GNUNET_assert (0);
@@ -210,7 +222,7 @@ testNamespace (int i)
   uri = GNUNET_FS_uri_to_string (ret);
   if (0 !=
       strcmp (uri,
-              "gnunet://fs/sks/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820/test"))
+              buf))
   {
     GNUNET_FS_uri_destroy (ret);
     GNUNET_free (uri);
@@ -221,6 +233,7 @@ testNamespace (int i)
   return 0;
 }
 
+
 static int
 testFile (int i)
 {