Author: gtjoseph Date: Tue Nov 4 18:27:30 2014 New Revision: 5899 URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5899 Log: testsuite: Add escaped semicolons tests for UpdateConfig and dialplan save
These are the testsuite tests for https://reviewboard.asterisk.org/r/4132/ Tested-by: George Joseph Review: https://reviewboard.asterisk.org/r/4136/ Added: asterisk/trunk/tests/manager/config/advanced/ asterisk/trunk/tests/manager/config/advanced/test-config.yaml (with props) asterisk/trunk/tests/manager/config/basic/ asterisk/trunk/tests/manager/config/basic/test-config.yaml (with props) asterisk/trunk/tests/manager/config/tests.yaml (with props) asterisk/trunk/tests/pbx/dialplan_save/ asterisk/trunk/tests/pbx/dialplan_save/configs/ asterisk/trunk/tests/pbx/dialplan_save/configs/ast1/ asterisk/trunk/tests/pbx/dialplan_save/configs/ast1/extensions.conf (with props) asterisk/trunk/tests/pbx/dialplan_save/run-test (with props) asterisk/trunk/tests/pbx/dialplan_save/test-config.yaml (with props) Removed: asterisk/trunk/tests/manager/config/test-config.yaml Modified: asterisk/trunk/tests/manager/tests.yaml asterisk/trunk/tests/pbx/tests.yaml Added: asterisk/trunk/tests/manager/config/advanced/test-config.yaml URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/config/advanced/test-config.yaml?view=auto&rev=5899 ============================================================================== --- asterisk/trunk/tests/manager/config/advanced/test-config.yaml (added) +++ asterisk/trunk/tests/manager/config/advanced/test-config.yaml Tue Nov 4 18:27:30 2014 @@ -1,0 +1,409 @@ +testinfo: + summary: 'Test Manager GetConfig and UpdateConfig' + description: | + 'Test Manager GetConfig and UpdateConfig' +properties: + minversion: '12.7.0' + dependencies: + - python : 'twisted' + - python : 'starpy' + tags: + - manager + - AMI + +test-modules: + add-test-to-search-path: 'True' + add-relative-to-search-path: ['..'] + test-object: + config-section: object-config + typename: 'ManagerConfigTest.ManagerConfigTest' + +object-config: + reactor-timeout: 15 + ami-config: + - ### Create a new config file + message: + Action: 'CreateConfig' + Filename: 'test.conf' + expected: + Response: 'Success' + Message: 'New configuration file created successfully' + + - ### Load initial values + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'NewCat' + Cat-000000: 'Cat1T' + Options-000000: 'template' + + Action-000001: 'Append' + Cat-000001: 'Cat1T' + Var-000001: 'type' + Value-000001: 'type1' + Options-000001: 'catfilter="TEMPLATES=restrict"' + + Action-000002: 'NewCat' + Cat-000002: 'Cat1' + Options-000002: 'inherit="Cat1T"' + + Action-000003: 'Append' + Cat-000003: 'Cat1' + Var-000003: 'var1' + Value-000003: 'value1' + + Action-000004: 'NewCat' + Cat-000004: 'Cat2T' + Options-000004: 'template' + + Action-000005: 'Append' + Cat-000005: 'Cat2T' + Var-000005: 'type' + Value-000005: 'type2' + Options-000005: 'catfilter="TEMPLATES=restrict"' + expected: + Response: 'Success' + + - ### Find the one concrete category + message: + Action: 'GetConfig' + Filename: 'test.conf' + expected: + Response: 'Success' + Category-000000: 'Cat1' + Templates-000000: 'Cat1T' + IsTemplate-000000: null + Line-000000-000000: 'type=type1' + Line-000000-000001: 'var1=value1' + Line-000000-000002: null + Category-000001: null + + - ### Find the fist template + message: + Action: 'GetConfig' + Filename: 'test.conf' + Category: 'Cat1T' + Filter: 'TEMPLATES=restrict' + expected: + Response: 'Success' + Category-000000: 'Cat1T' + IsTemplate-000000: '1' + Category-000001: null + + - ### Find both templates + message: + Action: 'GetConfig' + Filename: 'test.conf' + Filter: 'TEMPLATES=restrict' + expected: + Response: 'Success' + Category-000000: 'Cat1T' + IsTemplate-000000: '1' + Category-000001: 'Cat2T' + IsTemplate-000001: '1' + Category-000002: null + + - ### Find everything + message: + Action: 'GetConfig' + Filename: 'test.conf' + Filter: 'TEMPLATES=include' + expected: + Response: 'Success' + Category-000000: 'Cat1T' + IsTemplate-000000: '1' + Category-000001: 'Cat1' + IsTemplate-000001: null + Templates-000001: 'Cat1T' + Category-000002: 'Cat2T' + IsTemplate-000002: '1' + Category-000003: null + + - ### Test for non existent config file + message: + Action: 'GetConfig' + Filename: 'nonexistent.conf' + expected: + Response: 'Error' + + - ### Add a new category + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'NewCat' + Cat-000000: 'Cat3' + expected: + Response: 'Success' + + - ### Now delete it + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'DelCat' + Cat-000000: 'Cat3' + expected: + Response: 'Success' + + - ### Make sure it's gone + message: + Action: 'GetConfig' + Filename: 'test.conf' + Category: 'Cat3' + expected: + Response: 'Success' + Payload: 'No categories found' + + - ### Add a second Cat1 inheriting from Cat2T without ignoredups. Should fail. + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'NewCat' + Cat-000000: 'Cat1' + Options-000000: 'inherit="Cat2T"' + expected: + Response: 'Error' + Message: 'Create category did not complete successfully' + + - ### Add a second Cat1 inheriting from nonexistent cat. Should fail. + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'NewCat' + Cat-000000: 'Cat1' + Options-000000: 'ignoredups,inherit="CatZZZZZ"' + expected: + Response: 'Error' + Message: 'Create category did not complete successfully' + + - ### Add a second Cat1 inhetiting from Cat2T for real + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'NewCat' + Cat-000000: 'Cat1' + Options-000000: 'allowdups,inherit="Cat2T"' + + Action-000001: 'Append' + Cat-000001: 'Cat1' + Var-000001: 'varXXX' + Value-000001: 'valueXXX' + Options-000001: 'catfilter="type=type2"' + expected: + Response: 'Success' + + - ### With no filters make sure both Cat1's are returned + message: + Action: 'GetConfig' + Filename: 'test.conf' + Category: 'Cat1' + expected: + Response: 'Success' + Category-000000: 'Cat1' + Category-000001: 'Cat1' + Category-000002: null + + - ### With a filter make sure only 1 Cat1 is returned + message: + Action: 'GetConfig' + Filename: 'test.conf' + Category: 'Cat1' + Filter: 'varXXX=valueXXX' + expected: + Response: 'Success' + Category-000000: 'Cat1' + Line-000000-000000: 'type=type2' + Line-000000-000001: 'varXXX=valueXXX' + Line-000000-000002: null + Category-000001: null + + - ### With no filters this should delete BOTH Cat1's + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'DelCat' + Cat-000000: 'Cat1' + expected: + Response: 'Success' + + - ### Make sure both are gone + message: + Action: 'GetConfig' + Filename: 'test.conf' + Category: 'Cat1' + expected: + Response: 'Success' + Payload: 'No categories found' + Category-000000: null + + - ### Add 1 Cat1 back in again + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'NewCat' + Cat-000000: 'Cat1' + Options-000000: 'inherit="Cat1T"' + + Action-000001: 'Append' + Cat-000001: 'Cat1' + Var-000001: 'var1' + Value-000001: 'value1' + + Action-000002: 'Append' + Cat-000002: 'Cat1' + Var-000002: 'commonvar1' + Value-000002: 'commonvalue1' + + expected: + Response: 'Success' + + - ### Add a Cat2 in with a variable in common with Cat1 + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'NewCat' + Cat-000000: 'Cat2' + Options-000000: 'inherit="Cat2T"' + + Action-000001: 'Append' + Cat-000001: 'Cat2' + Var-000001: 'var2' + Value-000001: 'value2' + + Action-000002: 'Append' + Cat-000002: 'Cat2' + Var-000002: 'commonvar1' + Value-000002: 'commonvalue1' + expected: + Response: 'Success' + + - ### With only a filter make sure both Cat1 and Cat2 are returned + message: + Action: 'GetConfig' + Filename: 'test.conf' + Filter: 'commonvar1=commonvalue1' + expected: + Response: 'Success' + Category-000000: 'Cat1' + Category-000001: 'Cat2' + + - ### Now add a second Cat2 + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'NewCat' + Cat-000000: 'Cat2' + Options-000000: 'allowdups,inherit="Cat2T"' + + Action-000001: 'Append' + Cat-000001: 'Cat2' + Var-000001: 'var2' + Value-000001: 'value2' + + Action-000002: 'Append' + Cat-000002: 'Cat2' + Var-000002: 'commonvar1' + Value-000002: 'commonvalue1' + expected: + Response: 'Success' + + - ### Delete the commonvar1 from both + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'Delete' + Cat-000000: 'Cat2' + Var-000000: 'commonvar1' + expected: + Response: 'Success' + + - ### With only a filter only Cat1 should be returned + message: + Action: 'GetConfig' + Filename: 'test.conf' + Filter: 'commonvar1=commonvalue1' + expected: + Response: 'Success' + Category-000000: 'Cat1' + Category-000001: null + + - ### Just make sure all 3 are still there + message: + Action: 'GetConfig' + Filename: 'test.conf' + expected: + Response: 'Success' + Category-000000: 'Cat1' + Category-000001: 'Cat2' + Category-000002: 'Cat2' + Category-000003: null + + - ### Reset + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'DelCat' + Cat-000000: 'Cat1' + + Action-000001: 'DelCat' + Cat-000001: 'Cat2' + + Action-000002: 'NewCat' + Cat-000002: 'Cat1' + + Action-000003: 'Append' + Cat-000003: 'Cat1' + Var-000003: 'type' + Value-000003: 'type1' + + expected: + Response: 'Success' + + - ### Insert var1 back into Cat1 at line 0 + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'Insert' + Cat-000000: 'Cat1' + Var-000000: 'var1' + Value-000000: 'value1' + Line-000000: '0' + expected: + Response: 'Success' + + - ### Make sure lines are now in the right order + message: + Action: 'GetConfig' + Filename: 'test.conf' + Category: 'Cat1' + expected: + Response: 'Success' + Category-000000: 'Cat1' + Line-000000-000000: 'var1=value1' + Line-000000-000001: 'type=type1' + Line-000000-000002: null Propchange: asterisk/trunk/tests/manager/config/advanced/test-config.yaml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: asterisk/trunk/tests/manager/config/advanced/test-config.yaml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision URL Propchange: asterisk/trunk/tests/manager/config/advanced/test-config.yaml ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: asterisk/trunk/tests/manager/config/basic/test-config.yaml URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/config/basic/test-config.yaml?view=auto&rev=5899 ============================================================================== --- asterisk/trunk/tests/manager/config/basic/test-config.yaml (added) +++ asterisk/trunk/tests/manager/config/basic/test-config.yaml Tue Nov 4 18:27:30 2014 @@ -1,0 +1,277 @@ +testinfo: + summary: 'Test Manager GetConfig and UpdateConfig Basic Ops' + description: | + 'Test Manager GetConfig and UpdateConfig Basic Ops' +properties: + minversion: '1.8.0' + dependencies: + - python : 'twisted' + - python : 'starpy' + tags: + - manager + - AMI + +test-modules: + add-test-to-search-path: 'True' + add-relative-to-search-path: ['..'] + test-object: + config-section: object-config + typename: 'ManagerConfigTest.ManagerConfigTest' + +object-config: + reactor-timeout: 15 + ami-config: + - ### Create a new config file + message: + Action: 'CreateConfig' + Filename: 'test.conf' + expected: + Response: 'Success' + Message: 'New configuration file created successfully' + + - ### NewCat, Append and Insert + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'NewCat' + Cat-000000: 'Cat1' + + Action-000001: 'Append' + Cat-000001: 'Cat1' + Var-000001: 'var1' + Value-000001: 'value1 ;moreinfo' + + Action-000002: 'Append' + Cat-000002: 'Cat1' + Var-000002: 'var2' + Value-000002: 'value2 "moreinfo"' + + Action-000003: 'Insert' + Cat-000003: 'Cat1' + Var-000003: 'var0' + Value-000003: 'value0 \;moreinfo' + Line-000003: '0' + expected: + Response: 'Success' + + - ### Readback + message: + Action: 'GetConfig' + Filename: 'test.conf' + expected: + Response: 'Success' + Category-000000: 'Cat1' + Line-000000-000000: 'var0=value0 \;moreinfo' + Line-000000-000001: 'var1=value1 ;moreinfo' + Line-000000-000002: 'var2=value2 "moreinfo"' + Line-000000-000003: null + Category-000001: null + + - ### Delete, Update + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'Delete' + Cat-000000: 'Cat1' + Var-000000: 'var0' + + Action-000001: 'Append' + Cat-000001: 'Cat1' + Var-000001: 'var1' + Value-000001: 'value1 ;second' + + Action-000002: 'Update' + Cat-000002: 'Cat1' + Var-000002: 'var1' + Value-000002: 'value1 ;another' + Match-000002: 'value1 ;moreinfo' + expected: + Response: 'Success' + + - ### Readback + message: + Action: 'GetConfig' + Filename: 'test.conf' + expected: + Response: 'Success' + Category-000000: 'Cat1' + Line-000000-000000: 'var1=value1 ;another' + Line-000000-000001: 'var2=value2 "moreinfo"' + Line-000000-000002: 'var1=value1 ;second' + Line-000000-000003: null + Category-000001: null + + - ### RenameCat + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'RenameCat' + Cat-000000: 'Cat1' + value-000000: 'Cat2' + expected: + Response: 'Success' + + - ### Readback + message: + Action: 'GetConfig' + Filename: 'test.conf' + expected: + Response: 'Success' + Category-000000: 'Cat2' + Line-000000-000000: 'var1=value1 ;another' + Line-000000-000001: 'var2=value2 "moreinfo"' + Line-000000-000002: 'var1=value1 ;second' + Line-000000-000003: null + Category-000001: null + + - ### EmptyCat + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'EmptyCat' + Cat-000000: 'Cat2' + expected: + Response: 'Success' + + - ### Readback + message: + Action: 'GetConfig' + Filename: 'test.conf' + expected: + Response: 'Success' + Category-000000: 'Cat2' + Line-000000-000000: null + Category-000001: null + + - ### NewCat, DelCat + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'DelCat' + Cat-000000: 'Cat2' + + Action-000001: 'NewCat' + Cat-000001: 'Cat1' + expected: + Response: 'Success' + + - ### Readback + message: + Action: 'GetConfig' + Filename: 'test.conf' + expected: + Response: 'Success' + Category-000000: 'Cat1' + Category-000001: null + +### Negative tests + - + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'DelCat' + Cat-000000: 'Cat99' + + expected: + Response: 'Error' + - + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'RenameCat' + Cat-000000: 'Cat99' + + expected: + Response: 'Error' + - + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'RenameCat' + Cat-000000: 'Cat99' + Value-000000: 'Cat98' + + expected: + Response: 'Error' + - + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'Update' + Cat-000000: 'Cat99' + + expected: + Response: 'Error' + - + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'Update' + Cat-000000: 'Cat1' + + expected: + Response: 'Error' + - + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'Update' + Cat-000000: 'Cat1' + Var-000000: 'nonexistent' + + expected: + Response: 'Error' + - + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'Append' + Cat-000000: 'Cat1' + Var-000000: 'var1' + Value-000000: 'value1' + + Action-000001: 'Update' + Cat-000001: 'Cat1' + Var-000001: 'var1' + Value-000001: 'value2' + Match-000001: 'value99' + + expected: + Response: 'Error' + - + message: + Action: 'UpdateConfig' + SrcFilename: 'test.conf' + DstFilename: 'test.conf' + + Action-000000: 'Insert' + Cat-000000: 'Cat1' + Var-000000: 'var2' + Value-000000: 'value2' + + expected: + Response: 'Error' Propchange: asterisk/trunk/tests/manager/config/basic/test-config.yaml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: asterisk/trunk/tests/manager/config/basic/test-config.yaml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision URL Propchange: asterisk/trunk/tests/manager/config/basic/test-config.yaml ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: asterisk/trunk/tests/manager/config/tests.yaml URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/config/tests.yaml?view=auto&rev=5899 ============================================================================== --- asterisk/trunk/tests/manager/config/tests.yaml (added) +++ asterisk/trunk/tests/manager/config/tests.yaml Tue Nov 4 18:27:30 2014 @@ -1,0 +1,4 @@ +# Enter tests here in the order they should be considered for execution: +tests: + - test: 'basic' + - test: 'advanced' Propchange: asterisk/trunk/tests/manager/config/tests.yaml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: asterisk/trunk/tests/manager/config/tests.yaml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision URL Propchange: asterisk/trunk/tests/manager/config/tests.yaml ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: asterisk/trunk/tests/manager/tests.yaml URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/tests.yaml?view=diff&rev=5899&r1=5898&r2=5899 ============================================================================== --- asterisk/trunk/tests/manager/tests.yaml (original) +++ asterisk/trunk/tests/manager/tests.yaml Tue Nov 4 18:27:30 2014 @@ -6,7 +6,7 @@ - test: 'authtimeout' - test: 'acl-login' - test: 'bridge_actions' - - test: 'config' + - dir: 'config' - dir: 'danger' - test: 'originate' - test: 'device_state_changed' Added: asterisk/trunk/tests/pbx/dialplan_save/configs/ast1/extensions.conf URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/dialplan_save/configs/ast1/extensions.conf?view=auto&rev=5899 ============================================================================== --- asterisk/trunk/tests/pbx/dialplan_save/configs/ast1/extensions.conf (added) +++ asterisk/trunk/tests/pbx/dialplan_save/configs/ast1/extensions.conf Tue Nov 4 18:27:30 2014 @@ -1,0 +1,12 @@ +[general] +static=yes +writeprotect=no +autofallthrough=yes +clearglobalvars=no +extenpatternmatchnew=no + +[globals] +test1 = Alert-Info: \;answer-after=0 + +[incoming_1] +exten => 60.,1,NoOp(test \; message) Propchange: asterisk/trunk/tests/pbx/dialplan_save/configs/ast1/extensions.conf ------------------------------------------------------------------------------ svn:eol-style = native Propchange: asterisk/trunk/tests/pbx/dialplan_save/configs/ast1/extensions.conf ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision URL Propchange: asterisk/trunk/tests/pbx/dialplan_save/configs/ast1/extensions.conf ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: asterisk/trunk/tests/pbx/dialplan_save/run-test URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/dialplan_save/run-test?view=auto&rev=5899 ============================================================================== --- asterisk/trunk/tests/pbx/dialplan_save/run-test (added) +++ asterisk/trunk/tests/pbx/dialplan_save/run-test Tue Nov 4 18:27:30 2014 @@ -1,0 +1,119 @@ +#!/usr/bin/env python +''' +Copyright (C) 2014, Fairview 5 Engineering, LLC +George Joseph <[email protected]> + +This program is free software, distributed under the terms of +the GNU General Public License Version 2. +''' + +import sys +import logging +from twisted.internet import reactor + +sys.path.append("lib/python") +from asterisk.test_case import TestCase +LOGGER = logging.getLogger(__name__) + +class DialplanSaveTest(TestCase): + + def __init__(self): + TestCase.__init__(self) + # artificially high timeout as this can take a while + self.reactor_timeout = 300 + self.create_asterisk(1) + + def run(self): + TestCase.run(self) + + def callback(defer): + if defer.output.find("test1=Alert-Info: ;answer-after=0") == -1: + print "Dialplan did not load correctly" + print defer.output.strip() + reactor.callLater(1,self.failure) + else: + reactor.callLater(3,self.save) + + def errback(failure): + LOGGER.error("CLI dialplan show failed"); + reactor.callLater(1,self.failure) + + df = self.ast[0].cli_exec("dialplan show globals") + df.addCallback(callback) + df.addErrback(errback) + + def save(self): + + def callback(defer): + if defer.output.find("Dialplan successfully saved into") == -1: + print "Dialplan did not save correctly" + print defer.output.strip() + reactor.callLater(1,self.failure) + else: + reactor.callLater(3,self.reload) + + def errback(failure): + LOGGER.error("CLI dialplan save failed") + reactor.callLater(1,self.failure) + + df = self.ast[0].cli_exec("dialplan save") + df.addCallback(callback) + df.addErrback(errback) + + def reload(self): + + def callback(defer): + if defer.output.find("Dialplan reloaded.") == -1: + print "Dialplan did not reload correctly" + print defer.output.strip() + reactor.callLater(1,self.failure) + else: + reactor.callLater(3,self.retest) + + def errback(failure): + LOGGER.error("CLI dialplan reload") + reactor.callLater(1,self.failure) + + df = self.ast[0].cli_exec("dialplan reload") + df.addCallback(callback) + df.addErrback(errback) + + + def retest(self): + + def callback(defer): + if defer.output.find("test1=Alert-Info: ;answer-after=0") == -1: + print "Dialplan did not reload correctly" + print defer.output.strip() + reactor.callLater(1,self.failure) + else: + reactor.callLater(3,self.success) + + def errback(failure): + LOGGER.error("CLI dialplan show failed"); + reactor.callLater(1,self.failure) + + df = self.ast[0].cli_exec("dialplan show globals") + df.addCallback(callback) + df.addErrback(errback) + + def success(self): + self.passed = True + self.stop_reactor() + + def failure(self): + self.stop_reactor() + +def main(): + test = DialplanSaveTest() + test.start_asterisk() + reactor.run() + test.stop_asterisk() + if not test.passed: + return 1 + return 0 + +if __name__ == "__main__": + sys.exit(main() or 0) + +# vim:sw=4:ts=4:expandtab:textwidth=79 Propchange: asterisk/trunk/tests/pbx/dialplan_save/run-test ------------------------------------------------------------------------------ svn:eol-style = native Propchange: asterisk/trunk/tests/pbx/dialplan_save/run-test ------------------------------------------------------------------------------ svn:executable = * Propchange: asterisk/trunk/tests/pbx/dialplan_save/run-test ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision URL Propchange: asterisk/trunk/tests/pbx/dialplan_save/run-test ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: asterisk/trunk/tests/pbx/dialplan_save/test-config.yaml URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/dialplan_save/test-config.yaml?view=auto&rev=5899 ============================================================================== --- asterisk/trunk/tests/pbx/dialplan_save/test-config.yaml (added) +++ asterisk/trunk/tests/pbx/dialplan_save/test-config.yaml Tue Nov 4 18:27:30 2014 @@ -1,0 +1,12 @@ +testinfo: + summary: 'Test dialplan save with escaped semicolons' + description: | + 'This test verifies that saving a dialplan with escaped semicolons preserves the escapes.' + +properties: + minversion: '1.8.0.0' + dependencies: + - python : 'twisted' + - python : 'starpy' + tags: + - dialplan Propchange: asterisk/trunk/tests/pbx/dialplan_save/test-config.yaml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: asterisk/trunk/tests/pbx/dialplan_save/test-config.yaml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision URL Propchange: asterisk/trunk/tests/pbx/dialplan_save/test-config.yaml ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: asterisk/trunk/tests/pbx/tests.yaml URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/pbx/tests.yaml?view=diff&rev=5899&r1=5898&r2=5899 ============================================================================== --- asterisk/trunk/tests/pbx/tests.yaml (original) +++ asterisk/trunk/tests/pbx/tests.yaml Tue Nov 4 18:27:30 2014 @@ -11,6 +11,7 @@ - test: 'call-files' - test: 'callerid_match' - test: 'dialplan_reload' + - test: 'dialplan_save' - test: 'pbx_lua_goto' - test: 'pbx_lua_background' - test: 'manager_extensions' -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- svn-commits mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/svn-commits
