Commit e88a0a4a authored by DanmeiChen's avatar DanmeiChen
Browse files

add test for register with username with espace

parent 3863175f
......@@ -479,6 +479,46 @@ static void authenticated_register_with_provided_credentials(void){
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));
ms_free(addr);
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_address_unref(from);
ai = linphone_auth_info_new(username, NULL, test_password, NULL, NULL, NULL);
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_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_core_manager_destroy(lcm);
}
static void authenticated_register_with_wrong_late_credentials(void){
LinphoneCoreManager *lcm;
stats* counters;
......@@ -1325,6 +1365,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("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