Example #1
0
    def setUp(self):
        """Will add filters in
        order to run tests for mointerceptorm and mtinterceptorm as well as
        some dummy script files
        """
        yield jCliWithoutAuthTestCases.setUp(self)

        # Add a TransparentFilter (fid = f1)
        commands = [{'command': 'filter -a'},
                    {'command': 'fid f1'},
                    {'command': 'type TransparentFilter'},
                    {'command': 'ok', 'expect': r'Successfully added'},
                    ]
        yield self._test(r'jcli : ', commands)

        # Add a ConnectorFilter (fid = cf1)
        commands = [{'command': 'filter -a'},
                    {'command': 'fid cf1'},
                    {'command': 'type ConnectorFilter'},
                    {'command': 'cid Any'},
                    {'command': 'ok', 'expect': r'Successfully added'},
                    ]
        yield self._test(r'jcli : ', commands)

        # Add a UserFilter (fid = uf1)
        commands = [{'command': 'filter -a'},
                    {'command': 'fid uf1'},
                    {'command': 'type UserFilter'},
                    {'command': 'uid Any'},
                    {'command': 'ok', 'expect': r'Successfully added'},
                    ]
        yield self._test(r'jcli : ', commands)

        # Create script files
        self.invalid_syntax = '/tmp/invalid_syntax.py'
        self.file_not_found = '/file/not/found'
        self.valid_script = '/tmp/valid_script.py'

        with open(self.invalid_syntax, 'w') as fh:
            fh.write('Something to throw a syntax error')
        with open(self.valid_script, 'w') as fh:
            fh.write('print "hello  world"')
    def setUp(self):
        """Will add filters in
        order to run tests for mointerceptorm and mtinterceptorm as well as
        some dummy script files
        """
        yield jCliWithoutAuthTestCases.setUp(self)

        # Add a TransparentFilter (fid = f1)
        commands = [
            {
                'command': 'filter -a'
            },
            {
                'command': 'fid f1'
            },
            {
                'command': 'type TransparentFilter'
            },
            {
                'command': 'ok',
                'expect': r'Successfully added'
            },
        ]
        yield self._test(r'jcli : ', commands)

        # Add a ConnectorFilter (fid = cf1)
        commands = [
            {
                'command': 'filter -a'
            },
            {
                'command': 'fid cf1'
            },
            {
                'command': 'type ConnectorFilter'
            },
            {
                'command': 'cid Any'
            },
            {
                'command': 'ok',
                'expect': r'Successfully added'
            },
        ]
        yield self._test(r'jcli : ', commands)

        # Add a UserFilter (fid = uf1)
        commands = [
            {
                'command': 'filter -a'
            },
            {
                'command': 'fid uf1'
            },
            {
                'command': 'type UserFilter'
            },
            {
                'command': 'uid Any'
            },
            {
                'command': 'ok',
                'expect': r'Successfully added'
            },
        ]
        yield self._test(r'jcli : ', commands)

        # Create script files
        self.invalid_syntax = '/tmp/invalid_syntax.py'
        self.file_not_found = '/file/not/found'
        self.valid_script = '/tmp/valid_script.py'

        with open(self.invalid_syntax, 'w') as fh:
            fh.write('Something to throw a syntax error')
        with open(self.valid_script, 'w') as fh:
            fh.write('print "hello  world"')
Example #3
0
 def setUp(self):
     """Will add http and smpp connectors as well as some filters in
     order to run tests for morouterm and mtrouterm
     """
     yield jCliWithoutAuthTestCases.setUp(self)
     
     # Add an httpcc (cid = http1)
     commands = [{'command': 'httpccm -a'},
                 {'command': 'url http://127.0.0.1/Correct/Url'},
                 {'command': 'method post'},
                 {'command': 'cid http1'},
                 {'command': 'ok', 'expect': r'Successfully added'},
                 ]
     self._test(r'jcli : ', commands)
     
     # Add an httpcc (cid = http2)
     commands = [{'command': 'httpccm -a'},
                 {'command': 'url http://127.0.0.1/Correct/Url'},
                 {'command': 'method post'},
                 {'command': 'cid http2'},
                 {'command': 'ok', 'expect': r'Successfully added'},
                 ]
     self._test(r'jcli : ', commands)
     
     # Add an smppcc (cid = smpp1)
     commands = [{'command': 'smppccm -a'},
                 {'command': 'cid smpp1'},
                 {'command': 'ok', 'expect': r'Successfully added', 'wait': 0.2},
                 ]
     yield self._test(r'jcli : ', commands)
 
     # Add an smppcc (cid = smpp2)
     commands = [{'command': 'smppccm -a'},
                 {'command': 'cid smpp2'},
                 {'command': 'ok', 'expect': r'Successfully added', 'wait': 0.2},
                 ]
     yield self._test(r'jcli : ', commands)
 
     # Add a TransparentFilter (fid = f1)
     commands = [{'command': 'filter -a'},
                 {'command': 'fid f1'},
                 {'command': 'type TransparentFilter'},
                 {'command': 'ok', 'expect': r'Successfully added'},
                 ]
     self._test(r'jcli : ', commands)
 
     # Add a ConnectorFilter (fid = cf1)
     commands = [{'command': 'filter -a'},
                 {'command': 'fid cf1'},
                 {'command': 'type ConnectorFilter'},
                 {'command': 'cid Any'},
                 {'command': 'ok', 'expect': r'Successfully added'},
                 ]
     self._test(r'jcli : ', commands)
 
     # Add a UserFilter (fid = uf1)
     commands = [{'command': 'filter -a'},
                 {'command': 'fid uf1'},
                 {'command': 'type UserFilter'},
                 {'command': 'uid Any'},
                 {'command': 'ok', 'expect': r'Successfully added'},
                 ]
     self._test(r'jcli : ', commands)
Example #4
0
    def setUp(self):
        """Will add http and smpp connectors as well as some filters in
        order to run tests for morouterm and mtrouterm
        """
        yield jCliWithoutAuthTestCases.setUp(self)

        # Add an httpcc (cid = http1)
        commands = [
            {
                'command': 'httpccm -a'
            },
            {
                'command': 'url http://127.0.0.1/Correct/Url'
            },
            {
                'command': 'method post'
            },
            {
                'command': 'cid http1'
            },
            {
                'command': 'ok',
                'expect': r'Successfully added'
            },
        ]
        yield self._test(r'jcli : ', commands)

        # Add an httpcc (cid = http2)
        commands = [
            {
                'command': 'httpccm -a'
            },
            {
                'command': 'url http://127.0.0.1/Correct/Url'
            },
            {
                'command': 'method post'
            },
            {
                'command': 'cid http2'
            },
            {
                'command': 'ok',
                'expect': r'Successfully added'
            },
        ]
        yield self._test(r'jcli : ', commands)

        # Add an smppcc (cid = smpp1)
        commands = [
            {
                'command': 'smppccm -a'
            },
            {
                'command': 'cid smpp1'
            },
            {
                'command': 'ok',
                'expect': r'Successfully added',
                'wait': 0.4
            },
        ]
        yield self._test(r'jcli : ', commands)

        # Add an smppcc (cid = smpp2)
        commands = [
            {
                'command': 'smppccm -a'
            },
            {
                'command': 'cid smpp2'
            },
            {
                'command': 'ok',
                'expect': r'Successfully added',
                'wait': 0.4
            },
        ]
        yield self._test(r'jcli : ', commands)

        # Add a TransparentFilter (fid = f1)
        commands = [
            {
                'command': 'filter -a'
            },
            {
                'command': 'fid f1'
            },
            {
                'command': 'type TransparentFilter'
            },
            {
                'command': 'ok',
                'expect': r'Successfully added'
            },
        ]
        yield self._test(r'jcli : ', commands)

        # Add a ConnectorFilter (fid = cf1)
        commands = [
            {
                'command': 'filter -a'
            },
            {
                'command': 'fid cf1'
            },
            {
                'command': 'type ConnectorFilter'
            },
            {
                'command': 'cid Any'
            },
            {
                'command': 'ok',
                'expect': r'Successfully added'
            },
        ]
        yield self._test(r'jcli : ', commands)

        # Add a UserFilter (fid = uf1)
        commands = [
            {
                'command': 'filter -a'
            },
            {
                'command': 'fid uf1'
            },
            {
                'command': 'type UserFilter'
            },
            {
                'command': 'uid Any'
            },
            {
                'command': 'ok',
                'expect': r'Successfully added'
            },
        ]
        yield self._test(r'jcli : ', commands)