Commit 503dd139 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Some cleaning in register tester.

parent 293f1ce2
......@@ -89,7 +89,7 @@ static void register_with_refresh_base_3_for_algo(
reset_counters(counters);
linphone_core_set_transports(lc, transport);
proxy_cfg = linphone_proxy_config_new();
proxy_cfg = linphone_core_create_proxy_config(lc);
from = create_linphone_address_for_algo(domain, username);
......@@ -475,50 +475,42 @@ static void authenticated_register_with_provided_credentials(void){
BC_ASSERT_PTR_NULL(lp_config_get_string(linphone_core_get_config(lcm->lc), "auth_info_0", "passwd", NULL));
BC_ASSERT_PTR_NOT_NULL(lp_config_get_string(linphone_core_get_config(lcm->lc), "auth_info_0", "ha1", NULL));
linphone_proxy_config_destroy(cfg);
linphone_proxy_config_unref(cfg);
linphone_core_manager_destroy(lcm);
}
static void authenticated_register_with_provided_credentials_and_username_with_espace(void){
LinphoneCoreManager *lcm;
stats* counters;
LinphoneProxyConfig *cfg;
char route[256];
LinphoneAddress *from;
char *addr;
LinphoneAuthInfo *ai;
const char* username = "test username";
sprintf(route,"sip:%s",test_route);
lcm = linphone_core_manager_new(NULL);
counters = get_stats(lcm->lc);
cfg = linphone_core_create_proxy_config(lcm->lc);
from = create_linphone_address_for_algo(auth_domain,username);
linphone_proxy_config_set_identity(cfg, addr=linphone_address_as_string(from));
static void authenticated_register_with_provided_credentials_and_username_with_space(void) {
LinphoneCoreManager *lcm = linphone_core_manager_new(NULL);
stats *counters = get_stats(lcm->lc);
LinphoneProxyConfig *cfg = linphone_core_create_proxy_config(lcm->lc);
const char *username = "test username";
LinphoneAddress *from = create_linphone_address_for_algo(auth_domain, username);
char *addr = linphone_address_as_string(from);
linphone_proxy_config_set_identity(cfg, addr);
ms_free(addr);
linphone_proxy_config_enable_register(cfg,TRUE);
linphone_proxy_config_set_expires(cfg,1);
linphone_proxy_config_enable_register(cfg, TRUE);
linphone_proxy_config_set_expires(cfg, 1);
linphone_proxy_config_set_route(cfg, test_route);
linphone_proxy_config_set_server_addr(cfg,test_route);
linphone_proxy_config_set_server_addr(cfg, test_route);
linphone_address_unref(from);
ai = linphone_auth_info_new(username, NULL, test_password, NULL, NULL, NULL);
LinphoneAuthInfo *ai = linphone_auth_info_new(username, NULL, test_password, NULL, NULL, test_route);
linphone_core_add_auth_info(lcm->lc, ai);
linphone_auth_info_unref(ai);
linphone_core_add_proxy_config(lcm->lc, cfg);
BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1));
BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,0, int, "%d");
BC_ASSERT_TRUE(wait_for(lcm->lc, lcm->lc, &counters->number_of_LinphoneRegistrationOk, 1));
BC_ASSERT_EQUAL(counters->number_of_auth_info_requested, 0, int, "%d");
BC_ASSERT_PTR_NULL(lp_config_get_string(linphone_core_get_config(lcm->lc), "auth_info_0", "passwd", NULL));
BC_ASSERT_PTR_NOT_NULL(lp_config_get_string(linphone_core_get_config(lcm->lc), "auth_info_0", "ha1", NULL));
linphone_proxy_config_destroy(cfg);
linphone_proxy_config_unref(cfg);
linphone_core_manager_destroy(lcm);
}
static void authenticated_register_with_wrong_late_credentials(void){
LinphoneCoreManager *lcm;
stats* counters;
......@@ -1352,7 +1344,7 @@ test_t register_tests[] = {
TEST_NO_TAG("Authenticated register with wrong late credentials", authenticated_register_with_wrong_late_credentials),
TEST_NO_TAG("Authenticated register with late credentials", authenticated_register_with_late_credentials),
TEST_NO_TAG("Authenticated register with provided credentials", authenticated_register_with_provided_credentials),
TEST_NO_TAG("Authenticated register with provided credentials, username with espace", authenticated_register_with_provided_credentials_and_username_with_espace),
TEST_NO_TAG("Authenticated register with provided credentials, username with space", authenticated_register_with_provided_credentials_and_username_with_space),
TEST_NO_TAG("Register with refresh", simple_register_with_refresh),
TEST_NO_TAG("Authenticated register with refresh", simple_auth_register_with_refresh),
TEST_NO_TAG("Register with refresh and send error", register_with_refresh_with_send_error),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment