Skip to content

Commit

Permalink
Updated Test Cases
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshugt16 committed Nov 15, 2024
1 parent 2c6f4b7 commit ee81b1f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 0 additions & 1 deletion kairon/shared/cognition/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,6 @@ def validate_collection_name(bot: Text, collection: Text):
def get_pydantic_type(data_type: str):
if data_type == 'str':
return (constr(strict=True, min_length=1), ...)
# return (str, ...)
elif data_type == 'int':
return (int, ...)
elif data_type == 'float':
Expand Down
12 changes: 11 additions & 1 deletion tests/unit_test/data_processor/data_processor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1747,6 +1747,16 @@ async def test_sync_with_qdrant_success(self, mock_collection_upsert, mock_embed
timestamp=datetime.utcnow()
)
document.save()

saved_document = None
for doc in CognitionData.objects(bot=bot, collection=collection_name):
doc_dict = doc.to_mongo().to_dict()
if doc_dict.get("data", {}).get("id") == "2": # Match based on `data.id`
saved_document = doc_dict
break
assert saved_document, "Saved CognitionData document not found"
vector_id = saved_document["vector_id"]

if not isinstance(document, dict):
document = document.to_mongo().to_dict()

Expand Down Expand Up @@ -1789,7 +1799,7 @@ async def test_sync_with_qdrant_success(self, mock_collection_upsert, mock_embed
{
"points": [
{
"id": 12,
"id": vector_id,
"vector": embedding,
"payload": {'id': 2, 'item': 'Milk', 'price': 2.8, 'quantity': 5}
}
Expand Down

0 comments on commit ee81b1f

Please sign in to comment.