Skip to content

Commit b43afbc

Browse files
committed
Provide correct values to tested functions
1 parent 70f2334 commit b43afbc

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

tests/unit/app/endpoints/test_ols.py

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,11 @@ def test_retrieve_attachments_on_proper_input():
154154
query="Tell me about Kubernetes",
155155
conversation_id=conversation_id,
156156
attachments=[
157-
{
158-
"attachment_type": "log",
159-
"content_type": "text/plain",
160-
"content": "this is attachment",
161-
},
157+
Attachment(
158+
attachment_type="log",
159+
content_type="text/plain",
160+
content="this is attachment",
161+
),
162162
],
163163
)
164164
attachments = ols.retrieve_attachments(llm_request)
@@ -180,11 +180,11 @@ def test_retrieve_attachments_on_improper_attachment_type():
180180
query="Tell me about Kubernetes",
181181
conversation_id=conversation_id,
182182
attachments=[
183-
{
184-
"attachment_type": "not-correct-one",
185-
"content_type": "text/plain",
186-
"content": "this is attachment",
187-
},
183+
Attachment(
184+
attachment_type="not-correct-one",
185+
content_type="text/plain",
186+
content="this is attachment",
187+
),
188188
],
189189
)
190190
with pytest.raises(
@@ -201,11 +201,11 @@ def test_retrieve_attachments_on_improper_content_type():
201201
query="Tell me about Kubernetes",
202202
conversation_id=conversation_id,
203203
attachments=[
204-
{
205-
"attachment_type": "log",
206-
"content_type": "not/known",
207-
"content": "this is attachment",
208-
},
204+
Attachment(
205+
attachment_type="log",
206+
content_type="not/known",
207+
content="this is attachment",
208+
),
209209
],
210210
)
211211
with pytest.raises(
@@ -230,7 +230,7 @@ def test_store_conversation_history():
230230
llm_request,
231231
response,
232232
[],
233-
[],
233+
{},
234234
)
235235

236236
expected_history = CacheEntry(query=HumanMessage(query))
@@ -273,11 +273,11 @@ def test_store_conversation_history_empty_user_id():
273273
llm_request = LLMRequest(query="Tell me about Kubernetes")
274274
with pytest.raises(HTTPException, match="Invalid user ID"):
275275
ols.store_conversation_history(
276-
user_id, conversation_id, llm_request, "", [], []
276+
user_id, conversation_id, llm_request, "", [], {}
277277
)
278278
with pytest.raises(HTTPException, match="Invalid user ID"):
279279
ols.store_conversation_history(
280-
user_id, conversation_id, llm_request, None, [], []
280+
user_id, conversation_id, llm_request, None, [], {}
281281
)
282282

283283

@@ -289,7 +289,7 @@ def test_store_conversation_history_improper_user_id():
289289
llm_request = LLMRequest(query="Tell me about Kubernetes")
290290
with pytest.raises(HTTPException, match="Invalid user ID"):
291291
ols.store_conversation_history(
292-
user_id, conversation_id, llm_request, "", [], []
292+
user_id, conversation_id, llm_request, "", [], {}
293293
)
294294

295295

@@ -300,7 +300,7 @@ def test_store_conversation_history_improper_conversation_id():
300300
llm_request = LLMRequest(query="Tell me about Kubernetes")
301301
with pytest.raises(HTTPException, match="Invalid conversation ID"):
302302
ols.store_conversation_history(
303-
constants.DEFAULT_USER_UID, conversation_id, llm_request, "", [], []
303+
constants.DEFAULT_USER_UID, conversation_id, llm_request, "", [], {}
304304
)
305305

306306

@@ -469,6 +469,7 @@ def test_query_filter_with_one_redact_filter():
469469
llm_request = LLMRequest(query=query, conversation_id=conversation_id)
470470

471471
# use one custom filter
472+
assert config.ols_config.query_filters is not None
472473
q = Redactor(config.ols_config.query_filters)
473474
q.regex_filters = [
474475
RegexFilter(
@@ -492,6 +493,7 @@ def test_query_filter_with_two_redact_filters():
492493
llm_request = LLMRequest(query=query, conversation_id=conversation_id)
493494

494495
# use two custom filters
496+
assert config.ols_config.query_filters is not None
495497
q = Redactor(config.ols_config.query_filters)
496498
q.regex_filters = [
497499
RegexFilter(
@@ -566,6 +568,7 @@ def test_attachments_redact_with_one_filter_defined():
566568
]
567569

568570
# use two custom filters
571+
assert config.ols_config.query_filters is not None
569572
q = Redactor(config.ols_config.query_filters)
570573
q.regex_filters = [
571574
RegexFilter(
@@ -612,6 +615,7 @@ def test_attachments_redact_with_two_filters_defined():
612615
]
613616

614617
# use two custom filters
618+
assert config.ols_config.query_filters is not None
615619
q = Redactor(config.ols_config.query_filters)
616620
q.regex_filters = [
617621
RegexFilter(

0 commit comments

Comments
 (0)