Source code for odoo_xmlrpc_twisted.test.test_get_picture_string
"""test program for module :func:`odoo_xmlrpc_twisted.functions.get_picture_string`based on the "unittest" functionality"""importunittestimportosimportsysimportconfigparser# Import base test case for shared Odoo connectionfromodoo_xmlrpc_twisted.test.base_test_caseimportReadOnlyOdooTestCase# as this program is in the folder "test",# import the module to test from the subdirectory "support"current=os.path.dirname(os.path.realpath(__file__))parent_directory=os.path.dirname(current)sys.path.append(parent_directory+'/support')fromsupport_get_picture_stringimportsupport_get_picture_string# ------- 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 dedicated product_id of the customercustom_product_id=config.get('get_settings_product','product_id')# get the picture name of the picturecustom_name=config.get('get_settings_product','picture_name')# get the res_field name of the picturecustom_res_field=config.get('get_settings_product','res_field_name')
[docs]classtest_get_picture_string(ReadOnlyOdooTestCase):""" Class for the test cases of the module "get_picture_string" """
[docs]deftest_cases(self):""" test cases of the module "get_picture_string" """self.assertTrue(support_get_picture_string(custom_product_id,custom_res_field,custom_name))