Commit cf25820a authored by Simon Morlat's avatar Simon Morlat
Browse files

add new checks for ErrorInfo mechanism

parent 9d31ca0e
......@@ -111,6 +111,8 @@ static void subscribe_test_declined(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
LinphoneContent content={0};
LinphoneEvent *lev;
const LinphoneErrorInfo *ei;
MSList* lcs=ms_list_append(NULL,marie->lc);
lcs=ms_list_append(lcs,pauline->lc);
......@@ -122,13 +124,21 @@ static void subscribe_test_declined(void) {
pauline->decline_subscribe=TRUE;
linphone_core_subscribe(marie->lc,pauline->identity,"dodo",600,&content);
lev=linphone_core_subscribe(marie->lc,pauline->identity,"dodo",600,&content);
linphone_event_ref(lev);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionError,1,21000));/*yes flexisip may wait 20 secs in case of forking*/
ei=linphone_event_get_error_info(lev);
CU_ASSERT_PTR_NOT_NULL(ei);
if (ei){
CU_ASSERT_EQUAL(linphone_error_info_get_protocol_code(ei),603);
CU_ASSERT_PTR_NOT_NULL(linphone_error_info_get_phrase(ei));
}
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,1000));
linphone_event_unref(lev);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
......
......@@ -356,6 +356,22 @@ static void authenticated_register_with_wrong_credentials_with_params(const char
/*wait for retry*/
CU_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&counters->number_of_auth_info_requested,4));
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,1);
/*check the detailed error info */
if (!user_agent || strcmp(user_agent,"tester-no-403")!=0){
LinphoneProxyConfig *cfg=NULL;
linphone_core_get_default_proxy(mgr->lc,&cfg);
CU_ASSERT_PTR_NOT_NULL(cfg);
if (cfg){
const LinphoneErrorInfo *ei=linphone_proxy_config_get_error_info(cfg);
const char *phrase=linphone_error_info_get_phrase(ei);
CU_ASSERT_PTR_NOT_NULL(phrase);
if (phrase) CU_ASSERT_TRUE(strcmp(phrase,"Forbidden")==0);
CU_ASSERT_EQUAL(linphone_error_info_get_protocol_code(ei),403);
CU_ASSERT_PTR_NULL(linphone_error_info_get_details(ei));
}
}
linphone_core_manager_destroy(mgr);
}
static void authenticated_register_with_wrong_credentials() {
......
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