Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
jlonge4 committed Nov 13, 2024
1 parent 38fad06 commit 915aad9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class JinaReaderConnector:
Usage example:
```python
from haystack import Document
from haystack_integrations.components.connectors.jina import JinaReader
from haystack_integrations.components.connectors.jina import JinaReaderConnector
reader = JinaReader(mode="READ")
reader = JinaReaderConnector(mode="READ")
query = "https://example.com"
result = reader.run(query=query)
document = result["document"]
Expand Down
11 changes: 6 additions & 5 deletions integrations/jina/tests/test_reader_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from haystack_integrations.components.connectors.jina import JinaReaderConnector, JinaReaderMode

os.environ["JINA_API_KEY"] = "test-api-key"
os.environ["TEST_KEY"] = "test-api-key"


Expand Down Expand Up @@ -41,15 +42,15 @@ def test_from_dict(self):
component_dict = {
"type": "haystack_integrations.components.connectors.jina.reader.JinaReaderConnector",
"init_parameters": {
"mode": "GROUND",
"json_response": False,
"api_key": {"type": "env_var", "env_vars": ["TEST_KEY"]},
"api_key": {"type": "env_var", "env_vars": ["JINA_API_KEY"]},
"mode": "READ",
"json_response": True,
},
}

reader = JinaReaderConnector.from_dict(component_dict)

assert isinstance(reader, JinaReaderConnector)
assert reader.mode == JinaReaderMode.GROUND
assert reader.json_response is False
assert reader.mode == JinaReaderMode.READ
assert reader.json_response is True
assert reader.api_key.resolve_value() == "test-api-key"

0 comments on commit 915aad9

Please sign in to comment.