Source code for odoo_xmlrpc_twisted.test.test_create_dummy_product

"""
test program for module :func:`odoo_xmlrpc_twisted.functions.create_dummy_product`
based on the "unittest" functionality
"""


import unittest
import os
import sys
import configparser

# Import base test case for automatic cleanup
from odoo_xmlrpc_twisted.test.base_test_case import OdooTestCase

# as this program is in the folder "test",
# import the module to test from the parent directory
current = 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'))
from create_dummy_product import create_dummy_product



# ------- get parameter from the settings file "parameter_test.ini"

# Name and full path of the "ini" file
filename  = "parameter_test.ini"
# Get the parent directory (repo root) and navigate to config folder
current_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 email
custom_partner_id = config.get('get_settings_customer', 'partner_id')



[docs] class test_create_dummy_product(OdooTestCase): """ Class for the test cases of the module "create_dummy_product" """
[docs] def test_cases(self): """ test cases of the module "create_dummy_product" """ product_id = create_dummy_product(custom_partner_id) # Register created product for automatic cleanup if product_id: self.addCleanup_product(product_id) self.assertTrue(product_id)
if __name__ == "__main__": unittest.main()