Asterisk - The Open Source Telephony Project  21.4.1
Macros | Functions | Variables
test_voicemail_api.c File Reference

Skeleton Test. More...

#include "asterisk.h"
#include <sys/stat.h>
#include "asterisk/utils.h"
#include "asterisk/module.h"
#include "asterisk/test.h"
#include "asterisk/paths.h"
#include "asterisk/channel.h"
#include "asterisk/app.h"
#include "asterisk/format_cache.h"

Go to the source code of this file.

Macros

#define TOTAL_SNAPSHOTS   4
 
#define VM_API_FORWARD_MESSAGE(from_mailbox, from_context, from_folder, to_mailbox, to_context, to_folder, number_of_messages, message_numbers_in, delete_old)
 
#define VM_API_FORWARD_MESSAGE_OFF_NOMINAL(from_mailbox, from_context, from_folder, to_mailbox, to_context, to_folder, number_of_messages, message_numbers_in, delete_old)
 
#define VM_API_INT_VERIFY(expected, actual)
 
#define VM_API_MOVE_MESSAGE(mailbox, context, number_of_messages, source, message_numbers_in, dest)
 
#define VM_API_MOVE_MESSAGE_OFF_NOMINAL(mailbox, context, number_of_messages, source, message_numbers_in, dest)
 
#define VM_API_PLAYBACK_MESSAGE(channel, mailbox, context, folder, message, callback_fn)
 
#define VM_API_PLAYBACK_MESSAGE_OFF_NOMINAL(channel, mailbox, context, folder, message, callback_fn)
 
#define VM_API_REMOVE_MESSAGE(mailbox, context, number_of_messages, folder, message_numbers_in)
 
#define VM_API_REMOVE_MESSAGE_OFF_NOMINAL(mailbox, context, number_of_messages, folder, message_numbers_in)
 
#define VM_API_SNAPSHOT_CREATE(mailbox, context, folder, desc, sort, old_and_inbox)
 
#define VM_API_SNAPSHOT_MSG_VERIFY(expected, actual, expected_folder, expected_index)
 
#define VM_API_SNAPSHOT_OFF_NOMINAL_TEST(mailbox, context, folder, desc, sort, old_and_inbox)
 
#define VM_API_SNAPSHOT_TEST_CLEANUP
 
#define VM_API_STRING_FIELD_VERIFY(expected, actual)
 
#define VM_API_TEST_CLEANUP   test_vm_api_test_teardown()
 
#define VM_API_TEST_SETUP
 
#define VOICEMAIL_DIR_MODE   0777
 
#define VOICEMAIL_FILE_MODE   0666
 

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
 AST_TEST_DEFINE (voicemail_api_nominal_snapshot)
 
 AST_TEST_DEFINE (voicemail_api_off_nominal_snapshot)
 
 AST_TEST_DEFINE (voicemail_api_nominal_move)
 
 AST_TEST_DEFINE (voicemail_api_off_nominal_move)
 
 AST_TEST_DEFINE (voicemail_api_nominal_remove)
 
 AST_TEST_DEFINE (voicemail_api_off_nominal_remove)
 
 AST_TEST_DEFINE (voicemail_api_nominal_forward)
 
 AST_TEST_DEFINE (voicemail_api_off_nominal_forward)
 
 AST_TEST_DEFINE (voicemail_api_nominal_msg_playback)
 
 AST_TEST_DEFINE (voicemail_api_off_nominal_msg_playback)
 
static int get_folder_by_name (const char *folder)
 
static int load_module (void)
 
static void message_playback_callback_fn (struct ast_channel *chan, const char *file, int duration)
 
static struct ast_channeltest_vm_api_create_mock_channel (void)
 
static struct ast_vm_msg_snapshottest_vm_api_create_mock_snapshot (const char *context, const char *exten, const char *callerid)
 
static int test_vm_api_create_voicemail_files (const char *context, const char *mailbox, struct ast_vm_msg_snapshot *snapshot)
 
static int test_vm_api_create_voicemail_folder (const char *folder_path)
 
static void test_vm_api_destroy_mailbox_voicemails (const char *mailbox, struct ast_vm_mailbox_snapshot *mailbox_snapshot)
 
static void test_vm_api_destroy_mock_snapshot (struct ast_vm_msg_snapshot *snapshot)
 
static struct ast_frametest_vm_api_mock_channel_read (struct ast_channel *chan)
 
static int test_vm_api_mock_channel_write (struct ast_channel *chan, struct ast_frame *frame)
 
static void test_vm_api_remove_all_messages (void)
 
static void test_vm_api_remove_voicemail (struct ast_vm_msg_snapshot *snapshot)
 
static int test_vm_api_test_setup (void)
 
static void test_vm_api_test_teardown (void)
 
static void test_vm_api_update_test_snapshots (struct ast_vm_mailbox_snapshot *mailbox_snapshot)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Core Voicemail API Tests" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static int global_entered_playback_callback = 0
 
static const char *const mailbox_folders []
 
static const struct ast_channel_tech mock_channel_tech
 
static struct ast_vm_msg_snapshottest_snapshots [TOTAL_SNAPSHOTS]
 

Detailed Description

Skeleton Test.

Author
Matt Jordan <mjordan@digium.com> 

Tests for the publicly exposed Voicemail API

Definition in file test_voicemail_api.c.

Macro Definition Documentation

#define VM_API_SNAPSHOT_TEST_CLEANUP
Value:
if (test_mbox_snapshot) { \
test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot); \
} \
VM_API_TEST_CLEANUP; \
struct ast_vm_mailbox_snapshot * ast_vm_mailbox_snapshot_destroy(struct ast_vm_mailbox_snapshot *mailbox_snapshot)
destroy a snapshot
Definition: main/app.c:675

Definition at line 103 of file test_voicemail_api.c.

Variable Documentation

const struct ast_channel_tech mock_channel_tech
static
Initial value:
= {
.write = test_vm_api_mock_channel_write,
.read = test_vm_api_mock_channel_read,
}

Definition at line 804 of file test_voicemail_api.c.