repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | import pytest |
| #2 | |
| #3 | from embedchain.loaders.openapi import OpenAPILoader |
| #4 | |
| #5 | |
| #6 | @pytest.fixture |
| #7 | def openapi_loader(): |
| #8 | return OpenAPILoader() |
| #9 | |
| #10 | |
| #11 | def test_load_data(openapi_loader, mocker): |
| #12 | mocker.patch("builtins.open", mocker.mock_open(read_data="key1: value1\nkey2: value2")) |
| #13 | |
| #14 | mocker.patch("hashlib.sha256", return_value=mocker.Mock(hexdigest=lambda: "mock_hash")) |
| #15 | |
| #16 | file_path = "configs/openai_openapi.yaml" |
| #17 | result = openapi_loader.load_data(file_path) |
| #18 | |
| #19 | expected_doc_id = "mock_hash" |
| #20 | expected_data = [ |
| #21 | {"content": "key1: value1", "meta_data": {"url": file_path, "row": 1}}, |
| #22 | {"content": "key2: value2", "meta_data": {"url": file_path, "row": 2}}, |
| #23 | ] |
| #24 | |
| #25 | assert result["doc_id"] == expected_doc_id |
| #26 | assert result["data"] == expected_data |
| #27 |