[svn-commits] mnicholson: testsuite/asterisk/trunk r142 - in /asterisk/trunk/asttest: lib/l...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Mar 25 11:14:00 CDT 2010


Author: mnicholson
Date: Thu Mar 25 11:13:57 2010
New Revision: 142

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=142
Log:
Added helper functions to create login and logoff manager actions and modified the manager self test to use them.

Modified:
    asterisk/trunk/asttest/lib/lua/astlib.lua
    asterisk/trunk/asttest/self-tests/astlib_manager/test.lua

Modified: asterisk/trunk/asttest/lib/lua/astlib.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/asttest/lib/lua/astlib.lua?view=diff&rev=142&r1=141&r2=142
==============================================================================
--- asterisk/trunk/asttest/lib/lua/astlib.lua (original)
+++ asterisk/trunk/asttest/lib/lua/astlib.lua Thu Mar 25 11:13:57 2010
@@ -687,4 +687,28 @@
 	return a
 end
 
-
+-- some utility functions to access common manager functions are defined below
+
+--- Create a login action.
+-- This function creates a login action.  When called with no arguments, the
+-- default 'asttest', 'asttest' username secret is used.
+--
+-- @param username the username to send (defaults to 'asttest')
+-- @param secret the secret to send (defaults to 'asttest')
+function manager.action.login(username, secret)
+	local a = manager.action.new("Login")
+
+	username = username or "asttest"
+	secret = secret or "asttest"
+
+	a["Username"] = username
+	a["Secret"] = secret
+
+	return a
+end
+
+--- Create a logoff action.
+function manager.action.logoff()
+	return manager.action.new("Logoff")
+end
+

Modified: asterisk/trunk/asttest/self-tests/astlib_manager/test.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/asttest/self-tests/astlib_manager/test.lua?view=diff&rev=142&r1=141&r2=142
==============================================================================
--- asterisk/trunk/asttest/self-tests/astlib_manager/test.lua (original)
+++ asterisk/trunk/asttest/self-tests/astlib_manager/test.lua Thu Mar 25 11:13:57 2010
@@ -12,13 +12,9 @@
 	fail("error connecting to asterisk: " .. err)
 end
 
-login = ast.manager.action:new("login")
-login["Username"] = "asttest"
-login["Secret"] = "asttest"
+action = ast.manager.action
 
-logoff = ast.manager.action:new("logoff")
-
-r = m(login)
+r = m(action.login())
 if not r then
 	fail("error logging in to the manager: " .. err)
 end
@@ -27,7 +23,7 @@
 	fail("error authenticating: " .. r["Message"])
 end
 
-r = m(logoff)
+r = m(action.logoff())
 
 status, err = a:term_or_kill()
 if not status then




More information about the svn-commits mailing list