def test_associating_two_sccp_lines_with_users_does_not_make_the_db_fail( user1, user2, line1, line2, sccp1, sccp2): with a.line_endpoint_sccp(line1, sccp1, check=False), a.line_endpoint_sccp(line2, sccp2, check=False): response = confd.users(user1['id']).lines.post(line_id=line1['id']) response.assert_ok() response = confd.users(user2['id']).lines.post(line_id=line2['id']) response.assert_ok()
def test_delete_endpoint_dissociates_line(line, sccp): with a.line_endpoint_sccp(line, sccp, check=False): response = confd.endpoints.sccp(sccp['id']).delete() response.assert_deleted() response = confd.lines(line['id']).endpoints.sccp.get() response.assert_status(404)
def test_dissociate_sccp_endpoint_associated_to_device(user, line, extension, sccp, device): 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']).endpoints.sccp(sccp['id']).delete() response.assert_match(400, e.resource_associated())
def test_given_user_has_sccp_line_when_exporting_then_csv_has_line_fields( user, line, sccp): expected = has_entries(uuid=user['uuid'], line_protocol="sccp", context=line['context']) with a.line_endpoint_sccp(line, sccp), a.user_line(user, line): response = confd_csv.users.export.get() assert_that(response.csv(), has_item(expected))
def test_given_extension_associated_to_sccp_line_when_updated_then_cid_num_updated( user, line, sccp, extension): exten = h.extension.find_available_exten(config.CONTEXT) with a.line_endpoint_sccp(line, sccp), a.line_extension( line, extension), a.user_line(user, line): confd.extensions(extension['id']).put(exten=exten).assert_updated() response = confd.lines(line['id']).get() assert_that(response.item, has_entries(caller_id_num=exten))
def test_caller_id_on_sccp_line(user, line, sccp, extension): with a.line_endpoint_sccp(line, sccp), a.user_line(user, line), a.line_extension( line, extension): response = confd.lines(line['id']).get() assert_that( response.item, has_entries({ 'caller_id_name': 'Jôhn Smîth', 'caller_id_num': extension['exten'] }))
def test_get_line_associated_to_a_sccp_endpoint(line, sccp): response = confd.endpoints.sccp(sccp['id']).lines.get() response.assert_status(404) with a.line_endpoint_sccp(line, sccp): response = confd.endpoints.sccp(sccp['id']).lines.get() assert_that( response.item, has_entries({ 'line_id': line['id'], 'endpoint_id': sccp['id'], 'endpoint': 'sccp' }))
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'))
def test_summary_view_on_sccp_endpoint(user, line, sccp, extension): expected = has_entries(id=user['id'], uuid=user['uuid'], firstname=user['firstname'], lastname=user['lastname'], provisioning_code=none(), extension=extension['exten'], context=extension['context'], entity=config.ENTITY_NAME, enabled=True, protocol='sccp') with a.line_endpoint_sccp(line, sccp), a.line_extension(line, extension), \ a.user_line(user, line): response = confd.users.get(view='summary', id=user['id']) assert_that(response.items, contains(expected))
def test_get_user_line_main_associated_endpoints_sip_when_endpoint_is_sccp( user, line, sccp): with a.line_endpoint_sccp(line, sccp), a.user_line(user, line): response = confd.users( user['uuid']).lines.main.associated.endpoints.sip.get() assert_that(response.status, equal_to(404))
def test_dissociate_when_associated_to_extension(line, sccp, extension): with a.line_endpoint_sccp(line, sccp), a.line_extension(line, extension): response = confd.lines(line['id']).endpoints.sccp(sccp['id']).delete() response.assert_match(400, e.resource_associated('Line', 'Extension'))
def test_dissociate_when_associated_to_user(line, sccp, user): with a.line_endpoint_sccp(line, sccp), a.user_line(user, line): response = confd.lines(line['id']).endpoints.sccp(sccp['id']).delete() response.assert_match(400, e.resource_associated('Line', 'User'))
def test_associate_with_another_endpoint_when_already_associated( line, sccp1, sccp2): with a.line_endpoint_sccp(line, sccp1): response = confd.lines(line['id']).endpoints.sccp(sccp2['id']).put() response.assert_match(400, e.resource_associated('Line', 'Endpoint'))