From a2391a3e1120751cf516d245226e30dcff8507b2 Mon Sep 17 00:00:00 2001 From: Michael Zucci Date: Mon, 4 Dec 2000 12:59:01 +0000 Subject: added some imap tests, tho they dont get far yet and dont recover automatically. svn path=/trunk/; revision=6772 --- camel/tests/folder/Makefile.am | 8 +- camel/tests/folder/README | 9 +- camel/tests/folder/test1.c | 97 +-------------------- camel/tests/folder/test2.c | 194 +---------------------------------------- camel/tests/folder/test4.c | 73 ++++++++++++++++ camel/tests/folder/test5.c | 73 ++++++++++++++++ camel/tests/folder/test6.c | 74 ++++++++++++++++ camel/tests/folder/test7.c | 74 ++++++++++++++++ 8 files changed, 311 insertions(+), 291 deletions(-) create mode 100644 camel/tests/folder/test4.c create mode 100644 camel/tests/folder/test5.c create mode 100644 camel/tests/folder/test6.c create mode 100644 camel/tests/folder/test7.c (limited to 'camel/tests/folder') diff --git a/camel/tests/folder/Makefile.am b/camel/tests/folder/Makefile.am index aa430fa409..45f2e9895e 100644 --- a/camel/tests/folder/Makefile.am +++ b/camel/tests/folder/Makefile.am @@ -13,11 +13,13 @@ LDADD = \ $(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS) check_PROGRAMS = \ - test1 \ - test2 \ + test1 test4 test5 \ + test2 test6 test7 \ test3 -TESTS = test1 test2 test3 +TESTS = test1 test4 test5 \ + test2 test6 test7 \ + test3 diff --git a/camel/tests/folder/README b/camel/tests/folder/README index 994c4cdec4..fab1358198 100644 --- a/camel/tests/folder/README +++ b/camel/tests/folder/README @@ -1,4 +1,9 @@ test1 camel store folder operations (local only) -test2 basic folder operations -test3 folder searching and indexing +test2 basic folder operations, local +test3 folder searching and indexing, local +test4 camel store folder operations, IMAP +test5 camel store folder operations, NNTP +test6 basic folder operations, IMAP +test7 basic folder operations, NNTP + diff --git a/camel/tests/folder/test1.c b/camel/tests/folder/test1.c index 9ead130dfd..e7d1ac0604 100644 --- a/camel/tests/folder/test1.c +++ b/camel/tests/folder/test1.c @@ -1,6 +1,7 @@ /* store testing */ #include "camel-test.h" +#include "folders.h" #include #include @@ -27,9 +28,7 @@ static char *local_providers[] = { int main(int argc, char **argv) { CamelSession *session; - CamelStore *store; CamelException *ex; - CamelFolder *folder, *root; int i; char *path; @@ -46,103 +45,11 @@ int main(int argc, char **argv) /* todo: subscriptions? */ /* todo: work out how to do imap/pop/nntp tests */ for (i=0;ilen == j+1); - test_folder_message(folder, uids->pdata[j]); - pull(); - - push("checking it is the right message (subject): %s", subject); - info = camel_folder_get_message_info(folder, uids->pdata[j]); - check_msg(strcmp(camel_message_info_subject(info), subject)==0, - "info->subject %s", camel_message_info_subject(info)); - camel_folder_free_uids(folder, uids); - pull(); - - test_free(subject); - - check_unref(msg, 1); - pull(); - } - - check_unref(folder, 1); - pull(); - - push("deleting test folder, with messages in it"); - camel_store_delete_folder(store, "testbox", ex); - check(camel_exception_is_set(ex)); - camel_exception_clear(ex); - pull(); - - push("re-opening folder"); - folder = camel_store_get_folder(store, "testbox", flags, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - check(folder != NULL); - - /* verify counts */ - test_folder_counts(folder, 10, 10); - - /* re-check uid's, after a reload */ - uids = camel_folder_get_uids(folder); - check(uids != NULL); - check(uids->len == 10); - for (j=0;j<10;j++) { - char *subject = g_strdup_printf("Test message %d", j); - - push("verify reload of %s", subject); - test_folder_message(folder, uids->pdata[j]); - - info = camel_folder_get_message_info(folder, uids->pdata[j]); - check_msg(strcmp(camel_message_info_subject(info), subject)==0, - "info->subject %s", camel_message_info_subject(info)); - test_free(subject); - pull(); - } - - push("deleting first message & expunging"); - camel_folder_delete_message(folder, uids->pdata[0]); - test_folder_counts(folder, 10, 10); - camel_folder_expunge(folder, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - test_folder_not_message(folder, uids->pdata[0]); - test_folder_counts(folder, 9, 9); - - camel_folder_free_uids(folder, uids); - - uids = camel_folder_get_uids(folder); - check(uids != NULL); - check(uids->len == 9); - for (j=0;j<9;j++) { - char *subject = g_strdup_printf("Test message %d", j+1); - - push("verify after expunge of %s", subject); - test_folder_message(folder, uids->pdata[j]); - - info = camel_folder_get_message_info(folder, uids->pdata[j]); - check_msg(strcmp(camel_message_info_subject(info), subject)==0, - "info->subject %s", camel_message_info_subject(info)); - test_free(subject); - pull(); - } - pull(); - - push("deleting last message & expunging"); - camel_folder_delete_message(folder, uids->pdata[8]); - /* sync? */ - test_folder_counts(folder, 9, 9); - camel_folder_expunge(folder, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - test_folder_not_message(folder, uids->pdata[8]); - test_folder_counts(folder, 8, 8); - - camel_folder_free_uids(folder, uids); - - uids = camel_folder_get_uids(folder); - check(uids != NULL); - check(uids->len == 8); - for (j=0;j<8;j++) { - char *subject = g_strdup_printf("Test message %d", j+1); - - push("verify after expunge of %s", subject); - test_folder_message(folder, uids->pdata[j]); - - info = camel_folder_get_message_info(folder, uids->pdata[j]); - check_msg(strcmp(camel_message_info_subject(info), subject)==0, - "info->subject %s", camel_message_info_subject(info)); - test_free(subject); - pull(); - } - pull(); - - push("deleting all messages & expunging"); - for (j=0;j<8;j++) { - camel_folder_delete_message(folder, uids->pdata[j]); - } - /* sync? */ - test_folder_counts(folder, 8, 8); - camel_folder_expunge(folder, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - for (j=0;j<8;j++) { - test_folder_not_message(folder, uids->pdata[j]); - } - test_folder_counts(folder, 0, 0); - - camel_folder_free_uids(folder, uids); - pull(); - - check_unref(folder, 1); - pull(); /* re-opening folder */ - - push("deleting test folder, with no messages in it"); - camel_store_delete_folder(store, "testbox", ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - pull(); - - check_unref(store, 1); - camel_test_end(); - } + + test_folder_message_ops(session, name, TRUE); } check_unref(session, 1); diff --git a/camel/tests/folder/test4.c b/camel/tests/folder/test4.c new file mode 100644 index 0000000000..bae2b7bb0b --- /dev/null +++ b/camel/tests/folder/test4.c @@ -0,0 +1,73 @@ +/* store testing, for remote folders */ + +#include "camel-test.h" +#include "folders.h" + +#include +#include +#include +#include + +/* god, who designed this horrid interface */ +static char *auth_callback(CamelAuthCallbackMode mode, + char *data, gboolean secret, + CamelService *service, char *item, + CamelException *ex) +{ + return NULL; +} + +static int regtimeout() +{ + return 1; +} + +static int unregtimeout() +{ + return 1; +} + + +#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) + +static char *remote_providers[] = { + "IMAP_TEST_URL", +}; + +int main(int argc, char **argv) +{ + CamelSession *session; + CamelException *ex; + int i; + char *path; + + camel_test_init(argc, argv); + + ex = camel_exception_new(); + + /* clear out any camel-test data */ + system("/bin/rm -rf /tmp/camel-test"); + + session = camel_session_new("/tmp/camel-test", auth_callback, regtimeout, unregtimeout); + + /* todo: cross-check everything with folder_info checks as well */ + /* todo: subscriptions? */ + for (i=0;i +#include +#include +#include + +/* god, who designed this horrid interface */ +static char *auth_callback(CamelAuthCallbackMode mode, + char *data, gboolean secret, + CamelService *service, char *item, + CamelException *ex) +{ + return NULL; +} + +static int regtimeout() +{ + return 1; +} + +static int unregtimeout() +{ + return 1; +} + + +#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) + +static char *remote_providers[] = { + "NNTP_TEST_URL", +}; + +int main(int argc, char **argv) +{ + CamelSession *session; + CamelException *ex; + int i; + char *path; + + camel_test_init(argc, argv); + + ex = camel_exception_new(); + + /* clear out any camel-test data */ + system("/bin/rm -rf /tmp/camel-test"); + + session = camel_session_new("/tmp/camel-test", auth_callback, regtimeout, unregtimeout); + + /* todo: cross-check everything with folder_info checks as well */ + /* todo: subscriptions? */ + for (i=0;i +#include +#include +#include + +#include +#include +#include + +/* god, who designed this horrid interface */ +static char *auth_callback(CamelAuthCallbackMode mode, + char *data, gboolean secret, + CamelService *service, char *item, + CamelException *ex) +{ + return NULL; +} + +static int regtimeout() +{ + return 1; +} + +static int unregtimeout() +{ + return 1; +} + +#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) + +static char *remote_providers[] = { + "IMAP_TEST_URL", +}; + +int main(int argc, char **argv) +{ + CamelSession *session; + CamelException *ex; + int i; + char *path; + + camel_test_init(argc, argv); + + /* clear out any camel-test data */ + system("/bin/rm -rf /tmp/camel-test"); + + ex = camel_exception_new(); + + session = camel_session_new("/tmp/camel-test", auth_callback, regtimeout, unregtimeout); + + for (i=0;i +#include +#include +#include + +#include +#include +#include + +/* god, who designed this horrid interface */ +static char *auth_callback(CamelAuthCallbackMode mode, + char *data, gboolean secret, + CamelService *service, char *item, + CamelException *ex) +{ + return NULL; +} + +static int regtimeout() +{ + return 1; +} + +static int unregtimeout() +{ + return 1; +} + +#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) + +static char *remote_providers[] = { + "NNTP_TEST_URL", +}; + +int main(int argc, char **argv) +{ + CamelSession *session; + CamelException *ex; + int i; + char *path; + + camel_test_init(argc, argv); + + /* clear out any camel-test data */ + system("/bin/rm -rf /tmp/camel-test"); + + ex = camel_exception_new(); + + session = camel_session_new("/tmp/camel-test", auth_callback, regtimeout, unregtimeout); + + for (i=0;i