Skip to content

Commit

Permalink
[test_send] Added MMSC refusal test
Browse files Browse the repository at this point in the history
  • Loading branch information
monich committed Mar 5, 2014
1 parent 1eae87d commit 3e59e20
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 9 deletions.
File renamed without changes
File renamed without changes.
16 changes: 16 additions & 0 deletions mms-lib/test/send/data/Accept/smil
@@ -0,0 +1,16 @@
<!DOCTYPE smil PUBLIC "-//W3C//DTD SMIL 1.0//EN" "http://www.w3.org/TR/REC-smil/SMIL10.dtd">
<smil>
<head>
<layout>
<root-layout height="160" width="120"/>
<region fit="scroll" height="100%" left="0" top="0" width="100%" id="Text"/>
<region fit="meet" height="100%" left="0" top="0" width="100%" id="Media"/>
</layout>
</head>
<body>
<par dur="5000ms">
<text src="test.txt" region="Text"/>
<img src="0001.jpg" region="Media"/>
</par>
</body>
</smil>
File renamed without changes.
Binary file added mms-lib/test/send/data/Reject/0001.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mms-lib/test/send/data/Reject/m-send.conf
Binary file not shown.
1 change: 1 addition & 0 deletions mms-lib/test/send/data/Reject/test.txt
@@ -0,0 +1 @@
MMS Center rejection test
41 changes: 32 additions & 9 deletions mms-lib/test/send/test_send.c
Expand Up @@ -71,26 +71,46 @@ typedef struct test {
int ret;
} Test;

static const MMSAttachmentInfo test_files_success [] = {
static const MMSAttachmentInfo test_files_accept [] = {
{ "smil", NULL, NULL },
{ "0001.jpg", "image/jpeg", "image" },
{ "test.txt", "text/plain;charset=utf-8", "text" }
};

static const MMSAttachmentInfo test_files_reject [] = {
{ "0001.png", "image/png", "image" },
{ "test.txt", "text/plain", "text" }
};

static const TestDesc send_tests[] = {
{
"Success",
test_files_success,
G_N_ELEMENTS(test_files_success),
"Accept",
test_files_accept,
G_N_ELEMENTS(test_files_accept),
"Test of successful delivery",
"+1234567890",
NULL,
NULL,
"+2345678901,+3456789012",
"+4567890123",
0,
"m-send.conf",
MMS_CONTENT_TYPE,
SOUP_STATUS_OK,
MMS_SEND_STATE_SENDING,
"TestMessageId"
},{
"Reject",
test_files_reject,
G_N_ELEMENTS(test_files_reject),
"Rejection test",
"+1234567890",
NULL,
NULL,
0,
"m-send.conf",
MMS_CONTENT_TYPE,
SOUP_STATUS_OK,
MMS_SEND_STATE_REFUSED,
NULL
}
};

Expand All @@ -114,6 +134,9 @@ test_finish(
if (!msgid || strcmp(msgid, desc->msgid)) {
test->ret = RET_ERR;
MMS_ERR("%s msgid %s, expected %s", name, msgid, desc->msgid);
} else if (msgid && !desc->msgid) {
test->ret = RET_ERR;
MMS_ERR("%s msgidis not expected", name);
}
}
}
Expand Down Expand Up @@ -236,9 +259,9 @@ test_run_once(
desc->to, desc->cc, desc->bcc, desc->subject,
desc->flags & TEST_DISPATCHER_FLAGS, test.parts,
desc->nparts, &error);
MMS_ASSERT(!strcmp(imsi2, imsi));
MMS_ASSERT(imsi2 && !strcmp(imsi2, imsi));
test.id = g_strdup(id);
if (!strcmp(imsi2, imsi) && mms_dispatcher_start(test.disp)) {
if (imsi2 && !strcmp(imsi2, imsi) && mms_dispatcher_start(test.disp)) {
if (!debug) {
test.timeout_id = g_timeout_add_seconds(10,
test_timeout, &test);
Expand Down Expand Up @@ -320,7 +343,7 @@ int main(int argc, char* argv[])
if (verbose) {
mms_log_default.level = MMS_LOGLEVEL_VERBOSE;
} else {
mms_task_send_log.level = MMS_LOGLEVEL_ERR;
mms_task_send_log.level = MMS_LOGLEVEL_NONE;
mms_log_default.level = MMS_LOGLEVEL_INFO;
mms_log_stdout_timestamp = FALSE;
}
Expand Down

0 comments on commit 3e59e20

Please sign in to comment.