-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor test cases for DigiSync module
The test cases in the product_digi_sync module have been refactored for improved organization and separation of concerns. A base test case class, DigiSyncBaseTestCase, was introduced for encapsulating common functionality, reducing code duplication. Furthermore, increased the readability by structuring the unit test mock setups and cleanups.
- Loading branch information
1 parent
8b34b7c
commit 51023a8
Showing
3 changed files
with
49 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from unittest.mock import patch | ||
|
||
from odoo.addons.base.models.ir_config_parameter import IrConfigParameter | ||
from odoo.tests import TransactionCase | ||
|
||
|
||
class DigiSyncBaseTestCase(TransactionCase): | ||
def _patch_ir_config_parameter_for_get_param(self, client_id): | ||
original_get_param = IrConfigParameter.get_param | ||
|
||
def patched_get_param(self, key, default=False): | ||
if key == "digi_client_id": | ||
return client_id # return a specific value for a particular key | ||
else: | ||
return original_get_param(self, key, default) | ||
|
||
return patch.object(IrConfigParameter, "get_param", patched_get_param) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters