Beispiel #1
0
    def test_empty_sections(self):
        sccp_conf = SccpConf([], [], [])
        sccp_conf.generate(self._output)

        result = self._parse_ast_cfg()
        expected = { u'general': [], u'devices': [], u'lines': []}

        self.assertEqual(expected, result)
Beispiel #2
0
    def test_general_section(self):
        sccp = [{'name': u'bindaddr',
                 'value': u'0.0.0.0'},
                {'name': u'dateformat',
                 'value': u'D.M.Y'},
                {'name': u'keepalive',
                 'value': u'10'},
                {'name': u'authtimeout',
                 'value': u'10'}]

        sccp_conf = SccpConf(sccp, [], [])
        sccp_conf.generate(self._output)

        result = self._parse_ast_cfg()
        expected = {u'general': [u'bindaddr = 0.0.0.0',
                                 u'dateformat = D.M.Y',
                                 u'keepalive = 10',
                                 u'authtimeout = 10'],
                    u'lines': [],
                    u'devices': []}

        self.assertEqual(expected, result)
Beispiel #3
0
 def sccp_conf(self):
     config_generator = SccpConf.new_from_backend(self.backend)
     return self._generate_conf_from_generator(config_generator)
Beispiel #4
0
 def test_new_from_backend(self):
     backend = mock.Mock()
     SccpConf.new_from_backend(backend)
     backend.sccpgeneral.all.assert_called_once_with()
     backend.sccpline.all.assert_called_once_with()
     backend.sccpdevice.all.assert_called_once_with()