-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made review changes and added test cases.
- Loading branch information
Mahesh
committed
Dec 12, 2023
1 parent
7ea8bd6
commit 4c605f0
Showing
6 changed files
with
158 additions
and
57 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
Empty file.
7 changes: 0 additions & 7 deletions
7
kairon/chat/handlers/channels/business_messages/service_account_key.json
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -421,6 +421,34 @@ def __mock_endpoint(*args): | |
"test", | ||
"test") | ||
|
||
@responses.activate | ||
def test_save_channel_config_business_messages(self): | ||
def __mock_endpoint(*args): | ||
return f"https://[email protected]/api/bot/business_messages/tests/test" | ||
|
||
with patch('kairon.shared.data.utils.DataUtility.get_channel_endpoint', __mock_endpoint): | ||
channel_endpoint = ChatDataProcessor.save_channel_config( | ||
{ | ||
"connector_type": "business_messages", | ||
"config": { | ||
"type": "service_account", | ||
"private_key_id": "fa006e13b1e17eddf3990eede45ca6111eb74945", | ||
"private_key": "test_private_key", | ||
"client_email": "[email protected]", | ||
"client_id": "102056160806575769486" | ||
} | ||
}, | ||
"test", | ||
"test") | ||
assert channel_endpoint == "https://[email protected]/api/bot/business_messages/tests/test" | ||
business_messages_config = ChatDataProcessor.get_channel_config("business_messages", | ||
"test") | ||
assert business_messages_config['config'] == {'type': 'service_account', | ||
'private_key_id': 'fa006e13b1e17eddf3990eede45ca6111eb*****', | ||
'private_key': 'test_privat*****', | ||
'client_email': '[email protected]*****', | ||
'client_id': '1020561608065757*****'} | ||
|
||
@mock.patch('kairon.shared.utils.MongoClient', autospec=True) | ||
def test_fetch_session_history_error(self, mock_mongo): | ||
mock_mongo.side_effect = ServerSelectionTimeoutError("Failed to retrieve conversation: Failed to connect") | ||
|