(monkeypatch, feishu_reporter)
| 149 | |
| 150 | |
| 151 | def test_create_doc_uses_stdin_markdown(monkeypatch, feishu_reporter): |
| 152 | captured = {} |
| 153 | |
| 154 | def fake_run(args, **kwargs): |
| 155 | captured["args"] = args |
| 156 | captured["input"] = kwargs.get("input") |
| 157 | return SimpleNamespace( |
| 158 | stdout=json.dumps({"code": 0, "data": {"doc_id": "doc_test", "doc_url": "https://example.feishu.cn/docx/doc_test"}}), |
| 159 | stderr="", |
| 160 | returncode=0, |
| 161 | ) |
| 162 | |
| 163 | monkeypatch.setattr(feishu_reporter, "FEISHU_CLI_CMD", "lark-cli") |
| 164 | monkeypatch.setattr(feishu_reporter, "DEFAULT_IM_IDENTITY", "user") |
| 165 | monkeypatch.setattr(feishu_reporter.subprocess, "run", fake_run) |
| 166 | |
| 167 | result = feishu_reporter.create_doc("Test Doc", "# Heading\n\n- item 1\n- item 2") |
| 168 | |
| 169 | assert result["obj_token"] == "doc_test" |
| 170 | assert result["url"] == "https://example.feishu.cn/docx/doc_test" |
| 171 | assert captured["args"][captured["args"].index("--markdown") + 1] == "-" |
| 172 | assert captured["input"] == "# Heading\n\n- item 1\n- item 2" |
| 173 | |
| 174 | |
| 175 | def test_send_text_records_recent_outbound_chat_message(monkeypatch, feishu_reporter): |
nothing calls this directly
no outgoing calls
no test coverage detected