From 180de834ee72c1854fd5571c23eb91ec87431970 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 8 Dec 2014 14:31:17 +0100 Subject: [PATCH] Revert "Handle accounts manager to the Python module unit tests." This reverts commit b61302f9b1e0563e34bcb392fbaa1c3483dc3c73. --- tester/accountmanager.c | 16 ++---- tester/liblinphone_tester.h | 1 - .../linphone_testing_module.mustache | 52 ------------------- tools/python/unittests/linphonetester.py | 1 - tools/python/unittests/test_call.py | 4 -- tools/python/unittests/test_message.py | 4 -- tools/python/unittests/test_presence.py | 4 -- tools/python/unittests/test_register.py | 4 -- tools/python/unittests/test_setup.py | 4 -- 9 files changed, 5 insertions(+), 85 deletions(-) diff --git a/tester/accountmanager.c b/tester/accountmanager.c index 23794a6db..a3086f9cf 100644 --- a/tester/accountmanager.c +++ b/tester/accountmanager.c @@ -201,22 +201,16 @@ LinphoneAddress *account_manager_check_account(AccountManager *m, LinphoneProxyC return account->modified_identity; } -LinphoneAddress * account_manager_check_accounts(LinphoneCore *lc, LinphoneAddress *identity){ +void linphone_core_manager_check_accounts(LinphoneCoreManager *m){ const MSList *it; AccountManager *am=account_manager_get(); - for(it=linphone_core_get_proxy_config_list(lc);it!=NULL;it=it->next){ + for(it=linphone_core_get_proxy_config_list(m->lc);it!=NULL;it=it->next){ LinphoneProxyConfig *cfg=(LinphoneProxyConfig *)it->data; LinphoneAddress *modified_identity=account_manager_check_account(am,cfg); - if (identity){ - linphone_address_unref(identity); + if (m->identity){ + linphone_address_unref(m->identity); } - identity=linphone_address_ref(modified_identity); + m->identity=linphone_address_ref(modified_identity); } - - return identity; -} - -void linphone_core_manager_check_accounts(LinphoneCoreManager *m){ - m->identity=account_manager_check_accounts(m->lc,m->identity); } diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h index f776c21c8..12531a57f 100644 --- a/tester/liblinphone_tester.h +++ b/tester/liblinphone_tester.h @@ -279,7 +279,6 @@ void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreMana void liblinphone_tester_clock_start(MSTimeSpec *start); bool_t liblinphone_tester_clock_elapsed(const MSTimeSpec *start, int value_ms); void linphone_core_manager_check_accounts(LinphoneCoreManager *m); -LinphoneAddress * account_manager_check_accounts(LinphoneCore *lc, LinphoneAddress *identity); void account_manager_destroy(void); LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, const char* file, void* user_data); #ifdef ANDROID diff --git a/tools/python/apixml2python/linphone_testing_module.mustache b/tools/python/apixml2python/linphone_testing_module.mustache index 81b96f96d..b68f8a558 100644 --- a/tools/python/apixml2python/linphone_testing_module.mustache +++ b/tools/python/apixml2python/linphone_testing_module.mustache @@ -1,54 +1,4 @@ #include "private.h" -#include "liblinphone_tester.h" - -static PyObject * pylinphone_testing_module_method_check_accounts(PyObject *self, PyObject *args) { - PyObject *_core; - PyObject *_identity; - PyObject * pyresult; - PyObject * pyret; - LinphoneCore *_core_native_ptr; - LinphoneAddress *_identity_native_ptr; - - if (!PyArg_ParseTuple(args, "OO", &_core, &_identity)) { - return NULL; - } - if ((_core != Py_None) && !PyObject_IsInstance(_core, (PyObject *)&pylinphone_CoreType)) { - PyErr_SetString(PyExc_TypeError, "The '_core' argument must be a linphone.Core instance."); - return NULL; - } - if ((_core != Py_None) && !PyObject_IsInstance(_identity, (PyObject *)&pylinphone_AddressType)) { - PyErr_SetString(PyExc_TypeError, "The '_identity' argument must be a linphone.Address instance."); - return NULL; - } - - if ((_core != NULL) && (_core != Py_None)) { - if ((_core_native_ptr = pylinphone_Core_get_native_ptr(_core)) == NULL) { - return NULL; - } - } - if ((_identity != NULL) && (_identity != Py_None)) { - if ((_identity_native_ptr = pylinphone_Address_get_native_ptr(_core)) == NULL) { - return NULL; - } - } - - pylinphone_trace(1, "[PYLINPHONE] >>> %s(%p [%p], %p [%p])", __FUNCTION__, _core, _core_native_ptr, _identity, _identity_native_ptr); - _identity_native_ptr = account_manager_check_accounts(_core_native_ptr, _identity_native_ptr); - pylinphone_dispatch_messages(); - pyresult = pylinphone_Address_from_native_ptr(&pylinphone_AddressType, _identity_native_ptr); - pyret = Py_BuildValue("O", pyresult); - - pylinphone_trace(-1, "[PYLINPHONE] <<< %s -> %p", __FUNCTION__, pyret); - return pyret; -} - -static PyObject * pylinphone_testing_module_method_clean_accounts(PyObject *self, PyObject *args) { - pylinphone_trace(1, "[PYLINPHONE] >>> %s()", __FUNCTION__); - account_manager_destroy(); - pylinphone_dispatch_messages(); - pylinphone_trace(-1, "[PYLINPHONE] <<< %s -> None", __FUNCTION__); - Py_RETURN_NONE; -} static PyObject * pylinphone_testing_module_method_set_dns_user_hosts_file(PyObject *self, PyObject *args) { PyObject *_core; @@ -78,8 +28,6 @@ static PyObject * pylinphone_testing_module_method_set_dns_user_hosts_file(PyObj } static PyMethodDef pylinphone_TestingModuleMethods[] = { - { "check_accounts", pylinphone_testing_module_method_check_accounts, METH_VARARGS, "Checks that testing SIP accounts are created or creates them." }, - { "clean_accounts", pylinphone_testing_module_method_clean_accounts, METH_VARARGS, "Cleans the testing SIP accounts." }, { "set_dns_user_hosts_file", pylinphone_testing_module_method_set_dns_user_hosts_file, METH_VARARGS, "Allows to set a user specified hosts file." }, /* Sentinel */ { NULL, NULL, 0, NULL } diff --git a/tools/python/unittests/linphonetester.py b/tools/python/unittests/linphonetester.py index 8ed12e7f7..fcd485c79 100644 --- a/tools/python/unittests/linphonetester.py +++ b/tools/python/unittests/linphonetester.py @@ -493,7 +493,6 @@ class CoreManager: assert_equals(os.path.isfile(filepath), True) lc = linphone.Core.new(vtable, None, filepath) linphone.testing.set_dns_user_hosts_file(lc, os.path.join(resources_path, 'tester_hosts')) - self.identity = linphone.testing.check_accounts(lc, self.identity) lc.root_ca = os.path.join(resources_path, 'certificates', 'cn', 'cafile.pem') lc.ring = os.path.join(resources_path, 'sounds', 'oldphone.wav') lc.ringback = os.path.join(resources_path, 'sounds', 'ringback.wav') diff --git a/tools/python/unittests/test_call.py b/tools/python/unittests/test_call.py index b02daefea..93dfd1175 100644 --- a/tools/python/unittests/test_call.py +++ b/tools/python/unittests/test_call.py @@ -12,10 +12,6 @@ class TestCall: base, ext = os.path.splitext(os.path.basename(__file__)) cls.logger = Logger(base + '.log') - @classmethod - def teardown_class(cls): - linphone.testing.clean_accounts() - def test_early_declined_call(self): marie = CoreManager('marie_rc', logger=TestCall.logger) pauline = CoreManager('pauline_rc', logger=TestCall.logger) diff --git a/tools/python/unittests/test_message.py b/tools/python/unittests/test_message.py index 04c6fa260..56a7e9e17 100644 --- a/tools/python/unittests/test_message.py +++ b/tools/python/unittests/test_message.py @@ -13,10 +13,6 @@ class TestMessage: base, ext = os.path.splitext(os.path.basename(__file__)) cls.logger = Logger(base + '.log') - @classmethod - def teardown_class(cls): - linphone.testing.clean_accounts() - def wait_for_server_to_purge_messages(self, manager1, manager2): # Wait a little bit just to have time to purge message stored in the server CoreManager.wait_for_until(manager1, manager2, lambda manager1, manager2: False, 100) diff --git a/tools/python/unittests/test_presence.py b/tools/python/unittests/test_presence.py index 192dbae0f..3de4e2e2a 100644 --- a/tools/python/unittests/test_presence.py +++ b/tools/python/unittests/test_presence.py @@ -21,10 +21,6 @@ class TestPresence: base, ext = os.path.splitext(os.path.basename(__file__)) cls.logger = Logger(base + '.log') - @classmethod - def teardown_class(cls): - linphone.testing.clean_accounts() - def subscribe_to_callee_presence(self, caller_mgr, callee_mgr): initial_caller_stats = deepcopy(caller_mgr.stats) initial_callee_stats = deepcopy(callee_mgr.stats) diff --git a/tools/python/unittests/test_register.py b/tools/python/unittests/test_register.py index 6d444e70b..2660fbf1c 100644 --- a/tools/python/unittests/test_register.py +++ b/tools/python/unittests/test_register.py @@ -81,10 +81,6 @@ class TestRegister: base, ext = os.path.splitext(os.path.basename(__file__)) cls.logger = Logger(base + '.log') - @classmethod - def teardown_class(cls): - linphone.testing.clean_accounts() - def test_simple_register(self): cm = RegisterCoreManager(logger=TestRegister.logger) cm.register_with_refresh(False, None, None) diff --git a/tools/python/unittests/test_setup.py b/tools/python/unittests/test_setup.py index bb3d29c63..ff710217f 100644 --- a/tools/python/unittests/test_setup.py +++ b/tools/python/unittests/test_setup.py @@ -10,10 +10,6 @@ class TestSetup: base, ext = os.path.splitext(os.path.basename(__file__)) cls.logger = Logger(base + '.log') - @classmethod - def teardown_class(cls): - linphone.testing.clean_accounts() - def test_address(self): create_address(None)