Commit e32dd9cf authored by Erwan Croze's avatar Erwan Croze 👋🏻

Fix account_creator and account_creator_tester

parent e7637881
......@@ -836,11 +836,33 @@ LinphoneAccountCreatorStatus linphone_account_creator_activate_account_linphone(
}
request = linphone_xml_rpc_request_new_with_args(LinphoneXmlRpcArgString, "activate_phone_account",
LinphoneXmlRpcArgString, creator->phone_number,
LinphoneXmlRpcArgString, creator->username ? creator->username : creator->phone_number,
LinphoneXmlRpcArgString, creator->activation_code,
linphone_proxy_config_get_domain(creator->proxy_cfg),
LinphoneXmlRpcArgNone);
LinphoneXmlRpcArgString, creator->phone_number,
LinphoneXmlRpcArgString, creator->username ? creator->username : creator->phone_number,
LinphoneXmlRpcArgString, creator->activation_code,
linphone_proxy_config_get_domain(creator->proxy_cfg),
LinphoneXmlRpcArgNone);
linphone_xml_rpc_request_set_user_data(request, creator);
linphone_xml_rpc_request_cbs_set_response(linphone_xml_rpc_request_get_callbacks(request), _activate_account_cb_custom);
linphone_xml_rpc_session_send_request(creator->xmlrpc_session, request);
linphone_xml_rpc_request_unref(request);
return LinphoneAccountCreatorStatusRequestOk;
}
LinphoneAccountCreatorStatus linphone_account_creator_activate_email_account_linphone(LinphoneAccountCreator *creator) {
LinphoneXmlRpcRequest *request;
if (!creator->activation_code) {
if (creator->cbs->is_account_activated_response_cb != NULL) {
creator->cbs->is_account_activated_response_cb(creator, LinphoneAccountCreatorStatusMissingArguments, "Missing required parameters");
}
return LinphoneAccountCreatorStatusMissingArguments;
}
request = linphone_xml_rpc_request_new_with_args(LinphoneXmlRpcArgString, "activate_email_account",
LinphoneXmlRpcArgString, creator->username,
LinphoneXmlRpcArgString, creator->activation_code,
linphone_proxy_config_get_domain(creator->proxy_cfg),
LinphoneXmlRpcArgNone);
linphone_xml_rpc_request_set_user_data(request, creator);
linphone_xml_rpc_request_cbs_set_response(linphone_xml_rpc_request_get_callbacks(request), _activate_account_cb_custom);
......
......@@ -394,7 +394,7 @@ struct _LinphoneCall{
bool_t broken; /*set to TRUE when the call is in broken state due to network disconnection or transport */
bool_t defer_notify_incoming;
bool_t need_localip_refresh;
bool_t reinvite_on_cancel_response_requested;
bool_t non_op_error; /*set when the LinphoneErrorInfo was set at higher level than sal*/
......@@ -1525,12 +1525,19 @@ LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_is_account
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_create_account_linphone(LinphoneAccountCreator *creator);
/**
* Send an XML-RPC request to activate a Linphone account.
* Send an XML-RPC request to activate a Linphone account with phone number.
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorStatusRequestOk if the request has been sent, LinphoneAccountCreatorStatusRequestFailed otherwise
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_activate_account_linphone(LinphoneAccountCreator *creator);
/**
* Send an XML-RPC request to activate a Linphone account with email.
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorStatusRequestOk if the request has been sent, LinphoneAccountCreatorStatusRequestFailed otherwise
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_activate_email_account_linphone(LinphoneAccountCreator *creator);
/**
* Send an XML-RPC request to test the validation of a Linphone account.
* @param[in] creator LinphoneAccountCreator object
......
......@@ -493,6 +493,28 @@ static void server_delete_account_test(void) {
wait_for_until(marie->lc, NULL, &stats->cb_done, 1, TIMEOUT_REQUEST);
linphone_account_creator_unref(creator);
creator = _linphone_account_creator_new(marie->lc, XMLRPC_URL);
cbs = linphone_account_creator_get_callbacks(creator);
linphone_account_creator_cbs_set_user_data(cbs, stats);
account_creator_reset_cb_done(cbs);
linphone_account_creator_service_set_user_data(
linphone_account_creator_get_service(creator),
(void*)LinphoneAccountCreatorStatusRequestOk);
linphone_account_creator_set_username(creator, "XXXTESTuser_3");
linphone_account_creator_set_email(creator, "user_1@linphone.org");
linphone_account_creator_set_password(creator, "password");
BC_ASSERT_EQUAL(
delete_account_cb(creator),
LinphoneAccountCreatorStatusRequestOk,
LinphoneAccountCreatorStatus,
"%i");
wait_for_until(marie->lc, NULL, &stats->cb_done, 1, TIMEOUT_REQUEST);
ms_free(stats);
linphone_account_creator_unref(creator);
linphone_core_manager_destroy(marie);
......@@ -996,6 +1018,10 @@ static void server_activate_account_not_activated(void) {
(void*)LinphoneAccountCreatorStatusAccountActivated);
linphone_account_creator_cbs_set_activate_account(cbs, account_creator_cb);
linphone_account_creator_service_set_activate_account_cb(
linphone_account_creator_get_service(creator),
linphone_account_creator_activate_email_account_linphone);
BC_ASSERT_EQUAL(
linphone_account_creator_activate_account(creator),
LinphoneAccountCreatorStatusRequestOk,
......@@ -1026,6 +1052,9 @@ static void server_activate_account_already_activated(void) {
linphone_account_creator_get_service(creator),
(void*)LinphoneAccountCreatorStatusAccountAlreadyActivated);
linphone_account_creator_cbs_set_activate_account(cbs, account_creator_cb);
linphone_account_creator_service_set_activate_account_cb(
linphone_account_creator_get_service(creator),
linphone_account_creator_activate_email_account_linphone);
BC_ASSERT_EQUAL(
linphone_account_creator_activate_account(creator),
......@@ -1055,6 +1084,9 @@ static void server_activate_non_existent_account(void) {
linphone_account_creator_get_service(creator),
(void*)LinphoneAccountCreatorStatusAccountNotActivated);
linphone_account_creator_cbs_set_activate_account(cbs, account_creator_cb);
linphone_account_creator_service_set_activate_account_cb(
linphone_account_creator_get_service(creator),
linphone_account_creator_activate_email_account_linphone);
BC_ASSERT_EQUAL(
linphone_account_creator_activate_account(creator),
......@@ -1099,6 +1131,9 @@ static void server_activate_account_with_email_activated_arg_username_missing(vo
linphone_account_creator_get_service(creator),
(void*)LinphoneAccountCreatorStatusMissingArguments);
linphone_account_creator_cbs_set_activate_account(cbs, account_creator_cb);
linphone_account_creator_service_set_activate_account_cb(
linphone_account_creator_get_service(creator),
linphone_account_creator_activate_email_account_linphone);
BC_ASSERT_EQUAL(
linphone_account_creator_activate_account(creator),
......@@ -1125,6 +1160,9 @@ static void server_activate_account_with_email_activated_arg_activation_code_mis
linphone_account_creator_get_service(creator),
(void*)LinphoneAccountCreatorStatusMissingArguments);
linphone_account_creator_cbs_set_activate_account(cbs, account_creator_cb);
linphone_account_creator_service_set_activate_account_cb(
linphone_account_creator_get_service(creator),
linphone_account_creator_activate_email_account_linphone);
BC_ASSERT_EQUAL(
linphone_account_creator_activate_account(creator),
......
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