Skip to content

Commit

Permalink
fixed a few broken unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MinuraPunchihewa committed Nov 29, 2024
1 parent de437b8 commit cb35849
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/unit/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def check_ds_created(ds, mock_post, url):
self._compare_ds(ds, example_ds)
args, kwargs = mock_post.call_args

assert kwargs['headers'] == {'Authorization': 'Bearer ' + API_KEY}
assert kwargs['headers'] == {'Authorization': 'Bearer ' + API_KEY, 'Content-Type': 'application/json'}
assert kwargs['json'] == example_ds.model_dump()
assert args[0] == url

Expand Down Expand Up @@ -142,14 +142,15 @@ def test_create_knowledge_bases(self, mock_post, mock_get):

args, kwargs = mock_post.call_args

assert kwargs['headers'] == {'Authorization': 'Bearer ' + API_KEY}
assert kwargs['headers'] == {'Authorization': 'Bearer ' + API_KEY, 'Content-Type': 'application/json'}

expected_create_request = {
'name': test_knowledge_base_config.name,
'description': test_knowledge_base_config.description,
'vector_store': {
'engine': test_vector_store_config.engine,
'connection_data': test_vector_store_config.connection_data
'connection_data': test_vector_store_config.connection_data,
'table': test_vector_store_config.table
},
'embedding_model': {
'provider': test_embedding_config.provider,
Expand Down Expand Up @@ -443,3 +444,8 @@ def openai_completion_f(messages, *args, **kwargs):
if question == chunk.content.lower():
success = True
assert success is True


if __name__ == '__main__':
import pytest
pytest.main()

0 comments on commit cb35849

Please sign in to comment.