diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-08-20 04:14:15 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-08-20 04:14:15 +0800 |
commit | 5fb3a28aba18266a1cfc3759e6fc271a86531cb8 (patch) | |
tree | e39511d1d99ab08b529ea61f43df690b1f3b0b2a /camel/tests/smime | |
parent | 520d7194c4837f288733b29fa69f9cdde524fe38 (diff) | |
download | gsoc2013-evolution-5fb3a28aba18266a1cfc3759e6fc271a86531cb8.tar gsoc2013-evolution-5fb3a28aba18266a1cfc3759e6fc271a86531cb8.tar.gz gsoc2013-evolution-5fb3a28aba18266a1cfc3759e6fc271a86531cb8.tar.bz2 gsoc2013-evolution-5fb3a28aba18266a1cfc3759e6fc271a86531cb8.tar.lz gsoc2013-evolution-5fb3a28aba18266a1cfc3759e6fc271a86531cb8.tar.xz gsoc2013-evolution-5fb3a28aba18266a1cfc3759e6fc271a86531cb8.tar.zst gsoc2013-evolution-5fb3a28aba18266a1cfc3759e6fc271a86531cb8.zip |
Updated to pass the needed arguments to camel_init() and to init gthreads
2002-08-19 Jeffrey Stedfast <fejj@ximian.com>
* tests/lib/camel-test.c (camel_test_init): Updated to pass the
needed arguments to camel_init() and to init gthreads before camel
(since camel expectes it to be initialised already).
* tests/lib/session.c: #include <config.h> needed for
ENABLE_THREADS so that sizeof (CamelSessionClass) gives the
correct size.
* tests/*: Updated to work with camel API changes.
svn path=/trunk/; revision=17805
Diffstat (limited to 'camel/tests/smime')
-rw-r--r-- | camel/tests/smime/Makefile.am | 26 | ||||
-rw-r--r-- | camel/tests/smime/pgp-mime.c | 39 | ||||
-rw-r--r-- | camel/tests/smime/pgp.c | 19 |
3 files changed, 48 insertions, 36 deletions
diff --git a/camel/tests/smime/Makefile.am b/camel/tests/smime/Makefile.am index e8b098745f..a85f4044b8 100644 --- a/camel/tests/smime/Makefile.am +++ b/camel/tests/smime/Makefile.am @@ -1,16 +1,22 @@ -INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/camel \ - -I$(includedir) \ - -I$(top_srcdir)/camel/tests/lib \ - -DG_LOG_DOMAIN=\"evolution-tests\" +INCLUDES = \ + -I$(includedir) \ + -I$(top_srcdir) \ + -I$(top_srcdir)/intl \ + -I$(top_srcdir)/e-util \ + -I$(top_srcdir)/camel \ + -I$(top_srcdir)/camel/tests/lib \ + -DG_LOG_DOMAIN=\"evolution-tests\" \ + $(CAMEL_CFLAGS) LDADD = \ - $(top_builddir)/camel/libcamel.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/libibex/libibex.la \ - $(GNOME_LIBDIR) \ - $(top_builddir)/camel/tests/lib/libcameltest.a \ - $(GNOMEUI_LIBS) $(INTLLIBS) $(EVOLUTION_MAIL_LIBS) + $(top_builddir)/camel/libcamel.la \ + $(top_builddir)/e-util/libeutil.la \ + $(GNOME_LIBDIR) \ + $(top_builddir)/camel/tests/lib/libcameltest.a \ + $(GNOMEUI_LIBS) \ + $(INTLLIBS) \ + $(EVOLUTION_MAIL_LIBS) check_PROGRAMS = \ pgp \ diff --git a/camel/tests/smime/pgp-mime.c b/camel/tests/smime/pgp-mime.c index d2e243e084..c58b1866f3 100644 --- a/camel/tests/smime/pgp-mime.c +++ b/camel/tests/smime/pgp-mime.c @@ -3,7 +3,10 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <camel/camel-pgp-mime.h> +#include <camel/camel-gpg-context.h> +#include <camel/camel-multipart-signed.h> +#include <camel/camel-multipart-encrypted.h> +#include <camel/camel-mime-part.h> #include <camel/camel-stream-mem.h> #include "camel-test.h" @@ -94,10 +97,12 @@ camel_pgp_session_new (const char *path) int main (int argc, char **argv) { CamelSession *session; - CamelPgpContext *ctx; + CamelCipherContext *ctx; CamelException *ex; CamelCipherValidity *valid; - CamelMimePart *mime_part, *part; + CamelMimePart *mime_part; + CamelMultipartSigned *mps; + CamelMultipartEncrypted *mpe; GPtrArray *recipients; camel_test_init (argc, argv); @@ -109,7 +114,8 @@ int main (int argc, char **argv) session = camel_pgp_session_new ("/tmp/camel-test"); - ctx = camel_pgp_context_new (session, CAMEL_PGP_TYPE_GPG, "/usr/bin/gpg", FALSE); + ctx = camel_gpg_context_new (session, "/usr/bin/gpg"); + camel_gpg_context_set_always_trust (CAMEL_GPG_CONTEXT (ctx), TRUE); camel_test_start ("Test of PGP/MIME functions"); @@ -118,23 +124,22 @@ int main (int argc, char **argv) camel_mime_part_set_description (mime_part, "Test of PGP/MIME multipart/signed stuff"); camel_test_push ("PGP/MIME signing"); - camel_pgp_mime_part_sign (ctx, &mime_part, "pgp-mime@xtorshun.org", CAMEL_CIPHER_HASH_SHA1, ex); + mps = camel_multipart_signed_new (); + camel_multipart_signed_sign (mps, ctx, mime_part, "pgp-mime@xtorshun.org", CAMEL_CIPHER_HASH_SHA1, ex); check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); - check_msg (camel_pgp_mime_is_rfc2015_signed (mime_part), - "Huh, the MIME part does not seem to be a valid multipart/signed part"); camel_test_pull (); + camel_object_unref (mime_part); camel_exception_clear (ex); camel_test_push ("PGP/MIME verify"); - valid = camel_pgp_mime_part_verify (ctx, mime_part, ex); + valid = camel_multipart_signed_verify (mps, ctx, ex); check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); check_msg (camel_cipher_validity_get_valid (valid), "%s", camel_cipher_validity_get_description (valid)); camel_cipher_validity_free (valid); camel_test_pull (); - camel_object_unref (CAMEL_OBJECT (mime_part)); - + camel_object_unref (mps); camel_exception_clear (ex); mime_part = camel_mime_part_new (); @@ -144,23 +149,23 @@ int main (int argc, char **argv) camel_test_push ("PGP/MIME encrypt"); recipients = g_ptr_array_new (); g_ptr_array_add (recipients, "pgp-mime@xtorshun.org"); - camel_pgp_mime_part_encrypt (ctx, &mime_part, recipients, ex); + + mpe = camel_multipart_encrypted_new (); + camel_multipart_encrypted_encrypt (mpe, mime_part, ctx, "pgp-mime@xtorshun.org", recipients, ex); check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); - check_msg (camel_pgp_mime_is_rfc2015_encrypted (mime_part), - "Huh, the MIME part does not seem to be a valid multipart/encrypted part"); g_ptr_array_free (recipients, TRUE); camel_test_pull (); camel_exception_clear (ex); + camel_object_unref (mime_part); camel_test_push ("PGP/MIME decrypt"); - part = camel_pgp_mime_part_decrypt (ctx, mime_part, ex); + mime_part = camel_multipart_encrypted_decrypt (mpe, ctx, ex); check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); - camel_object_unref (CAMEL_OBJECT (part)); + camel_object_unref (mime_part); + camel_object_unref (mpe); camel_test_pull (); - camel_object_unref (CAMEL_OBJECT (mime_part)); - camel_object_unref (CAMEL_OBJECT (ctx)); camel_object_unref (CAMEL_OBJECT (session)); diff --git a/camel/tests/smime/pgp.c b/camel/tests/smime/pgp.c index 2d5ff7228c..3b422d222b 100644 --- a/camel/tests/smime/pgp.c +++ b/camel/tests/smime/pgp.c @@ -3,7 +3,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <camel/camel-pgp-context.h> +#include <camel/camel-gpg-context.h> #include <camel/camel-stream-mem.h> #include "camel-test.h" @@ -89,7 +89,7 @@ camel_pgp_session_new (const char *path) int main (int argc, char **argv) { CamelSession *session; - CamelPgpContext *ctx; + CamelCipherContext *ctx; CamelException *ex; CamelCipherValidity *valid; CamelStream *stream1, *stream2, *stream3; @@ -106,7 +106,8 @@ int main (int argc, char **argv) session = camel_pgp_session_new ("/tmp/camel-test"); - ctx = camel_pgp_context_new (session, CAMEL_PGP_TYPE_GPG, "/usr/bin/gpg", FALSE); + ctx = camel_gpg_context_new (session, "/usr/bin/gpg"); + camel_gpg_context_set_always_trust (CAMEL_GPG_CONTEXT (ctx), TRUE); camel_test_start ("Test of PGP functions"); @@ -117,8 +118,8 @@ int main (int argc, char **argv) stream2 = camel_stream_mem_new (); camel_test_push ("PGP signing"); - camel_pgp_sign (ctx, "pgp-mime@xtorshun.org", CAMEL_CIPHER_HASH_SHA1, - stream1, stream2, ex); + camel_cipher_sign (ctx, "pgp-mime@xtorshun.org", CAMEL_CIPHER_HASH_SHA1, + stream1, stream2, ex); check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); camel_test_pull (); @@ -127,7 +128,7 @@ int main (int argc, char **argv) camel_test_push ("PGP verify"); camel_stream_reset (stream1); camel_stream_reset (stream2); - valid = camel_pgp_verify (ctx, stream1, stream2, ex); + valid = camel_cipher_verify (ctx, CAMEL_CIPHER_HASH_SHA1, stream1, stream2, ex); check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); check_msg (camel_cipher_validity_get_valid (valid), "%s", camel_cipher_validity_get_description (valid)); camel_cipher_validity_free (valid); @@ -148,8 +149,8 @@ int main (int argc, char **argv) camel_test_push ("PGP encrypt"); recipients = g_ptr_array_new (); g_ptr_array_add (recipients, "pgp-mime@xtorshun.org"); - camel_pgp_encrypt (ctx, FALSE, "pgp-mime@xtorshun.org", recipients, - stream1, stream2, ex); + camel_cipher_encrypt (ctx, FALSE, "pgp-mime@xtorshun.org", recipients, + stream1, stream2, ex); check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); g_ptr_array_free (recipients, TRUE); camel_test_pull (); @@ -158,7 +159,7 @@ int main (int argc, char **argv) camel_exception_clear (ex); camel_test_push ("PGP decrypt"); - camel_pgp_decrypt (ctx, stream2, stream3, ex); + camel_cipher_decrypt (ctx, stream2, stream3, ex); check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); buf = CAMEL_STREAM_MEM (stream1)->buffer; before = g_strndup (buf->data, buf->len); |