Source code for odoo_xmlrpc_twisted.test.test_update_product
"""test program for module :func:`odoo_xmlrpc_twisted.functions.update_product`based on the "unittest" functionality"""importunittestimportosimportsysimportconfigparser# Import base test case for shared Odoo connectionfromodoo_xmlrpc_twisted.test.base_test_caseimportOdooTestCase# as this program is in the folder "test",# import the module to test from the parent directorycurrent=os.path.dirname(os.path.realpath(__file__))parent_directory=os.path.dirname(current)sys.path.append(parent_directory)sys.path.append(os.path.join(parent_directory,'functions'))fromupdate_productimportupdate_product# ------- get parameter from the settings file "parameter_test.ini" # Name and full path of the "ini" filefilename="parameter_test.ini"# Get the parent directory (repo root) and navigate to config foldercurrent_dir=os.path.dirname(os.path.abspath(__file__))parent_dir=os.path.dirname(current_dir)config_dir=os.path.join(parent_dir,'config')fullpath=os.path.join(config_dir,filename)config=configparser.ConfigParser()config.read(fullpath)# get the id of the productcustom_product_id=int(config.get('get_settings_product','product_id'))# get the new name of the productcustom_new_name=config.get('get_settings_product','new_name')# get the new description of the productcustom_new_description=config.get('get_settings_product','new_description')
[docs]classtest_update_product(OdooTestCase):""" Class for the test cases of the module "update_product" """
[docs]deftest_cases(self):""" test cases of the module "update_product" """self.assertTrue(update_product(custom_product_id,custom_new_name,custom_new_description))