Example #1
0
    def test_parking_lots_with_none_values(self):
        settings = {'general_options': [], 'parking_lots': []}
        parking_lots = [
            Mock(id=1,
                 slots_start='801',
                 slots_end='850',
                 extensions=[Mock(exten='800', context='default')],
                 music_on_hold=None,
                 timeout=None)
        ]

        res_parking_conf = self._new_conf(settings, parking_lots)

        assert_generates_config(
            res_parking_conf, '''
            [general]

            [parkinglot-1]
            parkext = 800
            context = default
            parkedmusicclass =
            parkpos = 801-850
            parkingtime = 0
            findslot = next
            parkext_exclusive = yes
            parkinghints = yes
            comebacktoorigin = yes
            parkedplay = caller
            parkedcalltransfers = no
            parkedcallreparking = no
            parkedcallhangup = no
            parkedcallrecording = no
        ''')
    def test_queues_section(self, find_queue_members_settings,
                            find_queue_settings):
        find_queue_settings.return_value = [{
            'name': 'grp-supertenant-42f6b00e-0181-427b-b885-cf0b95893762',
            'label': 'group 1',
            'wrapuptime': 0,
            'joinempty': '',
            'leaveempty': u'',
        }]
        find_queue_members_settings.return_value = [
            ('PJSIP/abc', '1', '', ''),
            ('iface', '2', 'name', 'state_iface'),
        ]

        assert_generates_config(
            self.queues_conf, '''
            [general]

            ; group 1
            [grp-supertenant-42f6b00e-0181-427b-b885-cf0b95893762]
            wrapuptime = 0
            member = PJSIP/abc,1,,
            member = iface,2,name,state_iface
        ''')
        find_queue_settings.assert_called_once_with()
        find_queue_members_settings.assert_called_once_with(
            'grp-supertenant-42f6b00e-0181-427b-b885-cf0b95893762')
    def test_escape_general_emailbody_option(self):
        self.voicemail_conf._voicemail_settings = [{'category': u'general',
                                                    'var_name': u'emailbody',
                                                    'var_val': u'foo\nbar'}]

        assert_generates_config(self.voicemail_conf, '''
            [general]
            emailbody = foo\\nbar

            [zonemessages]
        ''')
    def test_one_element_zonemessages_section(self):
        self.voicemail_conf._voicemail_settings = [{'category': u'zonemessages',
                                                    'var_name': u'foo',
                                                    'var_val': u'bar'}]

        assert_generates_config(self.voicemail_conf, '''
            [general]

            [zonemessages]
            foo = bar
        ''')
Example #5
0
    def test_minimal_settings(self):
        settings = {
            'general_options': [],
            'parking_lots': [],
        }

        res_parking_conf = self._new_conf(settings)

        assert_generates_config(res_parking_conf, '''
            [general]
        ''')
    def test_general_section(self, find_queue_general_settings):
        find_queue_general_settings.return_value = [
            {
                'var_name': 'autofill',
                'var_val': 'no'
            },
        ]

        assert_generates_config(
            self.queues_conf, '''
            [general]
            autofill = no
        ''')
        find_queue_general_settings.assert_called_once_with()
Example #7
0
    def test_minimal_settings(self):
        settings = {
            'general_options': [],
            'featuremap_options': [],
            'applicationmap_options': [],
        }

        features_conf = self._new_conf(settings)

        assert_generates_config(features_conf, '''
            [general]

            [featuremap]

            [applicationmap]
        ''')
    def test_voicemail_generation_included_in_config(self):
        self.voicemail_generator.generate.return_value = textwrap.dedent(
            """\
            [default]
            1000 => ,myvoicemail,,,

            """)

        assert_generates_config(self.voicemail_conf, '''
            [general]

            [zonemessages]

            [default]
            1000 => ,myvoicemail,,,
        ''')
Example #9
0
    def test_settings(self):
        settings = {
            'general_options': [(u'pickupexten', u'*8')],
            'featuremap_options': [(u'blindxfer', u'*1')],
            'applicationmap_options': [(u'toto', u'*1')],
        }

        features_conf = self._new_conf(settings)

        assert_generates_config(features_conf, '''
            [general]
            pickupexten = *8

            [featuremap]
            blindxfer = *1

            [applicationmap]
            toto = *1
        ''')
Example #10
0
    def test_settings(self):
        settings = {
            'general_options': [(u'parkeddynamic', u'no')],
            'parking_lots': [{
                'name': u'default',
                'options': [(u'parkext', u'700')]
            }],
        }

        res_parking_conf = self._new_conf(settings)

        assert_generates_config(
            res_parking_conf, '''
            [general]
            parkeddynamic = no

            [default]
            parkext = 700
        ''')
Example #11
0
    def test_generate(self):
        assert_generates_config(
            self._conf, '''
            [general]

            [xivo_device_tpl](!)

            [guest](xivo_device_tpl)
            type = device
            line = guestline

            [xivo_line_tpl](!)

            [guestline](xivo_line_tpl)
            type = line
            context = xivo-initconfig
            cid_name = Autoprov
            cid_num = autoprov
        ''')
 def test_empty_sections(self):
     assert_generates_config(self.queues_conf, '''
         [general]
     ''')
    def test_empty_sections(self):
        assert_generates_config(self.voicemail_conf, '''
            [general]

            [zonemessages]
        ''')