Esempio n. 1
0
def test_dissociate_sip_endpoint_associated_to_device(user, line, sip,
                                                      extension, device):
    with a.line_endpoint_sip(line,
                             sip), a.user_line(user, line), a.line_extension(
                                 line, extension), a.line_device(line, device):
        response = confd.lines(line['id']).endpoints.sip(sip['id']).delete()
        response.assert_match(400, e.resource_associated())
Esempio n. 2
0
def test_dissociate_when_line_associated_to_device(user, line, extension,
                                                   device):
    with a.line_extension(line, extension), a.user_line(user,
                                                        line), a.line_device(
                                                            line, device):
        response = confd.lines(line['id']).extension.delete()
        response.assert_match(400, e.resource_associated('Line', 'Device'))
Esempio n. 3
0
def test_given_backup_registrar_has_changed_when_sccp_line_updated_then_provd_updated(
        provd, user, line, sccp, extension, device):
    registrar = provd.configs.get('default')
    registrar['proxy_backup'] = '20.2.3.4'
    provd.configs.update(registrar)

    with a.line_endpoint_sccp(line, sccp), a.user_line(user, line), \
            a.line_extension(line, extension), a.line_device(line, device):

        response = confd.lines(line['id']).put()
        response.assert_updated()

        provd_config = provd.configs.get(device['id'])
        sccp_config = provd_config['raw_config']['sccp_call_managers']['2']
        assert_that(sccp_config, has_entries(ip='20.2.3.4'))
Esempio n. 4
0
def test_reset_to_autoprov_device_associated_to_line(provd, device, line):
    with a.line_device(line, device, check=False):
        response = confd.devices(device['id']).autoprov.get()
        response.assert_ok()

        response = confd.lines(line['id']).get()
        assert_that(response.item, has_entry('device_id', none()))

        device_cfg = provd.devices.get(device['id'])
        assert_that(device_cfg, has_entries(config=starts_with('autoprov')))
        assert_that(device_cfg, is_not(has_key('options')))

        config_cfg = provd.configs.get(device_cfg['config'])
        assert_that(config_cfg, not_none())

        response = confd.lines(line['id']).get()
        assert_that(response.item, has_entries(device_id=none()))
Esempio n. 5
0
def test_when_caller_id_updated_on_user_then_provd_is_updated(
        user, line, extension, device):
    with a.user_line(user, line), a.line_extension(line,
                                                   extension), a.line_device(
                                                       line, device):
        response = confd.users(
            user['id']).put(caller_id='"rôger rabbit" <1000>')
        response.assert_updated()

        provd_config = provd.configs.get(device['id'])
        sip_line = provd_config['raw_config']['sip_lines']['1']
        assert_that(
            sip_line,
            has_entries({
                'display_name': 'rôger rabbit',
                'number': extension['exten']
            }))
Esempio n. 6
0
def test_when_caller_id_updated_on_line_then_provd_is_updated(
        user, line, extension, device):
    with a.user_line(user, line), a.line_extension(line,
                                                   extension), a.line_device(
                                                       line, device):
        response = confd.lines(line['id']).put(caller_id_name="jôhn smîth",
                                               caller_id_num="1000")
        response.assert_updated()

        provd_config = provd.configs.get(device['id'])
        sip_line = provd_config['raw_config']['sip_lines']['1']
        assert_that(
            sip_line,
            has_entries({
                'display_name': 'jôhn smîth',
                'number': extension['exten']
            }))
Esempio n. 7
0
def test_given_config_registrar_has_changed_when_sip_line_updated_then_provd_updated(
        provd, user, line, sip, extension, device):
    registrar = provd.configs.get('default')
    registrar['registrar_main'] = '10.0.1.2'
    registrar['proxy_main'] = '11.1.2.3'
    provd.configs.update(registrar)

    with a.line_endpoint_sip(line, sip), a.user_line(user, line), \
            a.line_extension(line, extension), a.line_device(line, device):

        response = confd.lines(line['id']).put()
        response.assert_updated()

        provd_config = provd.configs.get(device['id'])
        sip_line = provd_config['raw_config']['sip_lines']['1']
        assert_that(sip_line,
                    has_entries(registrar_ip='10.0.1.2', proxy_ip='11.1.2.3'))
Esempio n. 8
0
def test_when_extension_updated_on_sip_line_then_provd_is_updated(
        user, line, sip, extension, device):
    exten = h.extension.find_available_exten(config.CONTEXT)
    line_cid = h.extension.find_available_exten(config.CONTEXT,
                                                exclude=[exten])

    with a.line_endpoint_sip(line, sip), a.user_line(user, line), \
            a.line_extension(line, extension), a.line_device(line, device):

        response = confd.extensions(extension['id']).put(exten=exten)
        response.assert_updated()

        response = confd.lines(line['id']).put(caller_id_num=line_cid)
        response.assert_updated()

        provd_config = provd.configs.get(device['id'])
        sip_line = provd_config['raw_config']['sip_lines']['1']
        assert_that(sip_line, has_entries(number=exten))
Esempio n. 9
0
def test_when_sip_username_and_password_are_updated_then_provd_is_updated(
        provd, user, line, sip, extension, device):
    with a.line_endpoint_sip(line, sip), a.user_line(user, line), \
            a.line_extension(line, extension), a.line_device(line, device):

        response = confd.endpoints.sip(sip['id']).put(username="******",
                                                      secret="mysecret")
        response.assert_updated()

        provd_config = provd.configs.get(device['id'])
        sip_line = provd_config['raw_config']['sip_lines']['1']
        assert_that(
            sip_line,
            has_entries({
                'auth_username': '******',
                'username': '******',
                'password': '******'
            }))