@@ -0,0 +1,3232 @@
+%EF%BB%BF# Copyright (c) 2016, LE GOFF Vincent%0A# All rights reserved.%0A%0A# Redistribution and use in source and binary forms, with or without%0A# modification, are permitted provided that the following conditions are met:%0A%0A# * Redistributions of source code must retain the above copyright notice, this%0A#   list of conditions and the following disclaimer.%0A%0A# * Redistributions in binary form must reproduce the above copyright notice,%0A#   this list of conditions and the following disclaimer in the documentation%0A#   and/or other materials provided with the distribution.%0A%0A# * Neither the name of ytranslate nor the names of its%0A#   contributors may be used to endorse or promote products derived from%0A#   this software without specific prior written permission.%0A%0A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS %22AS IS%22%0A# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE%0A# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE%0A# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE%0A# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL%0A# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR%0A# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER%0A# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,%0A# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE%0A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.%0A%0Afrom mock import MagicMock, call%0A%0Afrom models import MockClient%0Afrom scripting.alias import Alias%0A%0Aclass TestCommandStacking(MockClient):%0A%0A    %22%22%22Test of command stacking.%22%22%22%0A%0A    def test_without(self):%0A        %22%22%22Test without any command stacking.%22%22%22%0A        self.client.write(u%22say 1;say 2%22)%0A        self.client.transport.write.assert_called_once_with(%0A                %22say 1;say 2%5Cr%5Cn%22)%0A%0A    def test_simple(self):%0A        %22%22%22Test simple command stacking with a ; sign.%22%22%22%0A        def get_setting(address):%0A            %22%22%22Private function to return a set of default settings.%22%22%22%0A            default = %7B%0A                    %22options.input.command_stacking%22: %22;%22,%0A                    %22options.general.encoding%22: %22utf-8%22,%0A            %7D%0A            return default%5Baddress%5D%0A%0A        self.client.factory.engine.settings.__getitem__ = MagicMock(%0A                side_effect=get_setting)%0A        self.client.write(u%22say 1;say 2%22)%0A        calls = %5Bcall(%22say 1%5Cr%5Cn%22), call(%22say 2%5Cr%5Cn%22)%5D%0A        self.client.transport.write.assert_has_calls(calls)%0A%0A    def test_special(self):%0A        %22%22%22Test command stacking with a special character.%22%22%22%0A        def get_setting(address):%0A            %22%22%22Private function to return a set of default settings.%22%22%22%0A            default = %7B%0A                    %22options.input.command_stacking%22: u%22%5Cx82%22,%0A                    %22options.general.encoding%22: %22utf-8%22,%0A            %7D%0A            return default%5Baddress%5D%0A%0A        self.client.factory.engine.settings.__getitem__ = MagicMock(%0A                side_effect=get_setting)%0A        self.client.write(u%22say 1%5Cx82say 2%22)%0A        calls = %5Bcall(%22say 1%5Cr%5Cn%22), call(%22say 2%5Cr%5Cn%22)%5D%0A        self.client.transport.write.assert_has_calls(calls)%0A

Add tests for command stacking