Skip to content

Commit 67882dc

Browse files
committed
fix(tests): mock backend upload in viking knowledgebase test
1 parent a1b8358 commit 67882dc

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/test_knowledgebase.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,18 @@ async def test_knowledgebase():
3232

3333

3434
@pytest.mark.asyncio
35-
async def test_viking_knowledgebase_add_texts():
35+
async def test_viking_knowledgebase_add_texts(monkeypatch):
3636
app_name = "kb_test_app"
3737
kb = KnowledgeBase(
3838
backend="viking",
3939
app_name=app_name,
4040
)
41-
assert kb.add_from_text(text="test text", tag="tag") is True
41+
42+
# Mock the add_from_text method of the backend
43+
async def mock_tos_upload(*args, **kwargs):
44+
return True
45+
46+
monkeypatch.setattr(kb._backend._tos_client, "upload", mock_tos_upload)
47+
48+
result = kb.add_from_text(text="test text", tag="tag")
49+
assert result is True

0 commit comments

Comments
 (0)