-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: spandan_mondal <[email protected]>
- Loading branch information
Showing
5 changed files
with
194 additions
and
4 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
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
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from unittest.mock import patch | ||
|
||
import ujson as json | ||
import re | ||
import pytest | ||
import yaml | ||
from mongoengine import connect | ||
|
@@ -910,3 +911,15 @@ def _mock_get_bot_settings(*args, **kwargs): | |
errors = TrainingDataValidator.validate_content("your_bot_name", "[email protected]", bot_content) | ||
|
||
assert errors | ||
|
||
@patch('kairon.shared.cognition.processor.CognitionDataProcessor.is_collection_limit_exceeded_for_mass_uploading') | ||
def test_validate_content_collection_limit_exceeded(self, mock_is_collection_limit_exceeded): | ||
bot = 'test_bot' | ||
user = 'test_user' | ||
bot_content = [{'collection': 'collection1'}, {'collection': 'collection2'}] | ||
mock_is_collection_limit_exceeded.return_value = True | ||
|
||
errors = TrainingDataValidator.validate_content(bot, user, bot_content) | ||
|
||
assert 'Collection limit exceeded!' in errors | ||
mock_is_collection_limit_exceeded.assert_called_once_with(bot, user, ['collection1', 'collection2'], True) |