From c80f9f65c0f59bb9de4d9d037fdd0f3a088c922c Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 13 Mar 2018 17:16:11 +0100 Subject: [PATCH] Added test for single route --- tester/proxy_config_tester.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tester/proxy_config_tester.c b/tester/proxy_config_tester.c index a2bf63066..a07c0217f 100644 --- a/tester/proxy_config_tester.c +++ b/tester/proxy_config_tester.c @@ -243,12 +243,36 @@ static void load_dynamic_proxy_config(void) { } +static void single_route(void) { + LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); + LinphoneProxyConfig *marie_cfg = linphone_core_get_default_proxy_config(marie->lc); + BC_ASSERT_PTR_NOT_NULL(marie_cfg); + + const bctbx_list_t *routes = linphone_proxy_config_get_routes(marie_cfg); + BC_ASSERT_PTR_NOT_NULL(routes); + BC_ASSERT_EQUAL(bctbx_list_size(routes), 1, int, "%d"); + const char *route = (const char *)bctbx_list_get_data(routes); + BC_ASSERT_STRING_EQUAL(linphone_proxy_config_get_route(marie_cfg), "sip:sip.example.org;transport=tcp;lr"); + BC_ASSERT_STRING_EQUAL(route, "sip:sip.example.org;transport=tcp;lr"); + + linphone_proxy_config_set_route(marie_cfg, "sip.linphone.org"); + routes = linphone_proxy_config_get_routes(marie_cfg); + BC_ASSERT_PTR_NOT_NULL(routes); + BC_ASSERT_EQUAL(bctbx_list_size(routes), 1, int, "%d"); + route = (const char *)bctbx_list_get_data(routes); + BC_ASSERT_STRING_EQUAL(linphone_proxy_config_get_route(marie_cfg), "sip:sip.linphone.org"); + BC_ASSERT_STRING_EQUAL(route, "sip:sip.linphone.org"); + + linphone_core_manager_destroy(marie); +} + test_t proxy_config_tests[] = { TEST_NO_TAG("Phone normalization without proxy", phone_normalization_without_proxy), TEST_NO_TAG("Phone normalization with proxy", phone_normalization_with_proxy), TEST_NO_TAG("Phone normalization with dial escape plus", phone_normalization_with_dial_escape_plus), TEST_NO_TAG("SIP URI normalization", sip_uri_normalization), - TEST_NO_TAG("Load new default value for proxy config", load_dynamic_proxy_config) + TEST_NO_TAG("Load new default value for proxy config", load_dynamic_proxy_config), + TEST_NO_TAG("Single route", single_route) }; test_suite_t proxy_config_test_suite = {"Proxy config", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each,