From 7b4156981d77aa20a9052895e92754a672eb747b Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Wed, 27 Dec 2017 14:10:13 +0100 Subject: [PATCH] add test for register with username with espace --- tester/register_tester.c | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tester/register_tester.c b/tester/register_tester.c index cf456e5be..6e5f3a104 100644 --- a/tester/register_tester.c +++ b/tester/register_tester.c @@ -422,6 +422,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_with_username(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(lcm->lc->config, "auth_info_0", "passwd", NULL)); + BC_ASSERT_PTR_NOT_NULL(lp_config_get_string(lcm->lc->config, "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; @@ -1267,6 +1307,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),