diff options
Diffstat (limited to 'camel/tests/folder/test1.c')
-rw-r--r-- | camel/tests/folder/test1.c | 97 |
1 files changed, 2 insertions, 95 deletions
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 <camel/camel-exception.h> #include <camel/camel-service.h> @@ -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;i<ARRAY_LEN(local_providers);i++) { - char *what = g_strdup_printf("testing local store: %s", local_providers[i]); - - camel_test_start(what); - g_free(what); - - push("getting store"); path = g_strdup_printf("%s:///tmp/camel-test/%s", local_providers[i], local_providers[i]); - store = camel_session_get_store(session, path, ex); - check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex)); - check(store != NULL); - pull(); - - /* local providers == no root folder */ - push("getting root folder"); - root = camel_store_get_root_folder(store, ex); - check(camel_exception_is_set(ex)); - check(root == NULL); - camel_exception_clear(ex); - pull(); - - /* same for default folder */ - push("getting default folder"); - root = camel_store_get_root_folder(store, ex); - check(camel_exception_is_set(ex)); - check(root == NULL); - camel_exception_clear(ex); - pull(); - - push("getting a non-existant folder, no create"); - folder = camel_store_get_folder(store, "unknown", 0, ex); - check(camel_exception_is_set(ex)); - check(folder == NULL); - camel_exception_clear(ex); - pull(); - - push("getting a non-existant folder, with create"); - folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - check(folder != NULL); - camel_object_unref((CamelObject *)folder); - pull(); - - push("getting an existing folder"); - folder = camel_store_get_folder(store, "testbox", 0, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - check(folder != NULL); - camel_object_unref((CamelObject *)folder); - pull(); - - push("renaming a non-existant folder"); - camel_store_rename_folder(store, "unknown1", "unknown2", ex); - check(camel_exception_is_set(ex)); - camel_exception_clear(ex); - pull(); - - push("renaming an existing folder"); - camel_store_rename_folder(store, "testbox", "testbox2", ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - pull(); - - push("opening the old name of a renamed folder"); - folder = camel_store_get_folder(store, "testbox", 0, ex); - check(camel_exception_is_set(ex)); - check(folder == NULL); - camel_exception_clear(ex); - pull(); - - push("opening the new name of a renamed folder"); - folder = camel_store_get_folder(store, "testbox2", 0, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - check(folder != NULL); - camel_object_unref((CamelObject *)folder); - pull(); - - push("deleting a non-existant folder"); - camel_store_delete_folder(store, "unknown", ex); - check(camel_exception_is_set(ex)); - camel_exception_clear(ex); - pull(); - - push("deleting an existing folder"); - camel_store_delete_folder(store, "testbox2", ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - pull(); - - push("opening a folder that has been deleted"); - folder = camel_store_get_folder(store, "testbox2", 0, ex); - check(camel_exception_is_set(ex)); - check(folder == NULL); - camel_exception_clear(ex); - pull(); - camel_object_unref((CamelObject *)store); + test_folder_basic(session, path, TRUE); g_free(path); - - camel_test_end(); } camel_object_unref((CamelObject *)session); |