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.gmail import GmailLoader |
| #4 | |
| #5 | |
| #6 | @pytest.fixture |
| #7 | def mock_beautifulsoup(mocker): |
| #8 | return mocker.patch("embedchain.loaders.gmail.BeautifulSoup", return_value=mocker.MagicMock()) |
| #9 | |
| #10 | |
| #11 | @pytest.fixture |
| #12 | def gmail_loader(mock_beautifulsoup): |
| #13 | return GmailLoader() |
| #14 | |
| #15 | |
| #16 | def test_load_data_file_not_found(gmail_loader, mocker): |
| #17 | with pytest.raises(FileNotFoundError): |
| #18 | with mocker.patch("os.path.isfile", return_value=False): |
| #19 | gmail_loader.load_data("your_query") |
| #20 | |
| #21 | |
| #22 | @pytest.mark.skip(reason="TODO: Fix this test. Failing due to some googleapiclient import issue.") |
| #23 | def test_load_data(gmail_loader, mocker): |
| #24 | mock_gmail_reader_instance = mocker.MagicMock() |
| #25 | text = "your_test_email_text" |
| #26 | metadata = { |
| #27 | "id": "your_test_id", |
| #28 | "snippet": "your_test_snippet", |
| #29 | } |
| #30 | mock_gmail_reader_instance.load_data.return_value = [ |
| #31 | { |
| #32 | "text": text, |
| #33 | "extra_info": metadata, |
| #34 | } |
| #35 | ] |
| #36 | |
| #37 | with mocker.patch("os.path.isfile", return_value=True): |
| #38 | response_data = gmail_loader.load_data("your_query") |
| #39 | |
| #40 | assert "doc_id" in response_data |
| #41 | assert "data" in response_data |
| #42 | assert isinstance(response_data["doc_id"], str) |
| #43 | assert isinstance(response_data["data"], list) |
| #44 |