[asterisk-dev] [Code Review] 3693: A test of the Authenticate application to ensure that it fails properly.

Tyler Austin Cambron reviewboard at asterisk.org
Thu Aug 14 16:12:27 CDT 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3693/
-----------------------------------------------------------

(Updated Aug. 14, 2014, 4:12 p.m.)


Status
------

This change has been marked as submitted.


Review request for Asterisk Developers.


Changes
-------

Committed in revision 5449


Bugs: Asterisk-23953
    https://issues.asterisk.org/jira/browse/Asterisk-23953


Repository: testsuite


Description
-------

This test uses the dialplan to enter the Authenticate application, which has been given a hard coded password, and sends the wrong dtmf password three times. The Authenticate application should respond twice with the sound file "auth-incorrect", and then after a third incorrect try, play "vm-goodbye" and end the session. This test checks, using a header match, to ensure that "auth-incorrect" is played twice, followed by "vm-goodbye". To make the test give off an event for the playing of "vm-goodbye", the line of code that was in charge of raising the event in app.c had to be moved to file.c. I will post the diff in this description for clarification. The AppTest module also had to be modified to allow for an action to be executed each time that the event is matched instead of just executing once, regardless of the number of times the header match was told to match the event.

app.c and file.c diff file:
Index: app.c
===================================================================
--- app.c	(revision 415357)
+++ app.c	(working copy)
@@ -256,7 +256,6 @@
 
 	filename = ast_strdupa(prompt);
 	while ((front = strsep(&filename, "&"))) {
-		ast_test_suite_event_notify("PLAYBACK", "Message: %s\r\nChannel: %s", front, ast_channel_name(c));
 		if (!ast_strlen_zero(front)) {
 			res = ast_streamfile(c, front, ast_channel_language(c));
 			if (res)
Index: file.c
===================================================================
--- file.c	(revision 415357)
+++ file.c	(working copy)
@@ -1105,6 +1105,7 @@
 		return -1;
 	if (vfs && ast_applystream(chan, vfs))
 		return -1;
+	ast_test_suite_event_notify("PLAYBACK", "Message: %s\r\nChannel: %s", filename, ast_channel_name(chan));
 	res = ast_playstream(fs);
 	if (!res && vfs)
 		res = ast_playstream(vfs);
@@ -1611,7 +1612,6 @@
 {
 	int res = 0;
 	if (!ast_strlen_zero(file)) {
-		ast_test_suite_event_notify("PLAYBACK", "Message: %s\r\nChannel: %s", file, ast_channel_name(chan));
 		res = ast_streamfile(chan, file, ast_channel_language(chan));
 		if (!res) {
 			res = ast_waitstream(chan, digits);


Diffs
-----

  /asterisk/trunk/tests/apps/tests.yaml 5202 
  /asterisk/trunk/tests/apps/authenticate/tests.yaml PRE-CREATION 
  /asterisk/trunk/tests/apps/authenticate/off_nominal/test-config.yaml PRE-CREATION 
  /asterisk/trunk/tests/apps/authenticate/off_nominal/configs/ast1/extensions.conf PRE-CREATION 
  /asterisk/trunk/lib/python/asterisk/apptest.py 5202 

Diff: https://reviewboard.asterisk.org/r/3693/diff/


Testing
-------

The test passes, and the logs show a call is made, the incorrect DTMF password is sent three times, the correct sound files are played as according to the header matches, and the session terminates upon hearing "vm-goodbye".


Thanks,

Tyler Austin Cambron

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140814/9e979ad0/attachment-0001.html>


More information about the asterisk-dev mailing list