mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-06 01:52:12 +00:00
fix: Slack tests (#1032)
This commit is contained in:
parent
da5c0f36f6
commit
9763835873
2 changed files with 11 additions and 10 deletions
|
|
@ -14,7 +14,9 @@ This guide walks you through setting up Open SWE end-to-end: local development,
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/langchain-ai/open-swe.git
|
git clone https://github.com/langchain-ai/open-swe.git
|
||||||
cd open-swe
|
cd open-swe
|
||||||
uv sync
|
uv venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
uv sync --all-extras
|
||||||
```
|
```
|
||||||
|
|
||||||
## 2. Create a GitHub App
|
## 2. Create a GitHub App
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ def test_select_slack_context_messages_detects_username_mention() -> None:
|
||||||
assert [item["ts"] for item in selected] == ["1.0", "2.0", "3.0"]
|
assert [item["ts"] for item in selected] == ["1.0", "2.0", "3.0"]
|
||||||
|
|
||||||
|
|
||||||
def test_get_slack_repo_config_uses_existing_thread_repo(
|
def test_get_slack_repo_config_message_repo_overrides_existing_thread_repo(
|
||||||
monkeypatch: pytest.MonkeyPatch,
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
) -> None:
|
) -> None:
|
||||||
captured: dict[str, str] = {}
|
captured: dict[str, str] = {}
|
||||||
|
|
@ -164,11 +164,9 @@ def test_get_slack_repo_config_uses_existing_thread_repo(
|
||||||
webapp.get_slack_repo_config("please use repo:new-owner/new-repo", "C123", "1.234")
|
webapp.get_slack_repo_config("please use repo:new-owner/new-repo", "C123", "1.234")
|
||||||
)
|
)
|
||||||
|
|
||||||
assert repo == {"owner": "saved-owner", "name": "saved-repo"}
|
assert repo == {"owner": "new-owner", "name": "new-repo"}
|
||||||
assert threads_client.requested_thread_id == generate_thread_id_from_slack_thread(
|
assert threads_client.requested_thread_id is None
|
||||||
"C123", "1.234"
|
assert captured["text"] == "Using repository: `new-owner/new-repo`"
|
||||||
)
|
|
||||||
assert captured["text"] == "Using repository: `saved-owner/saved-repo`"
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_slack_repo_config_parses_message_for_new_thread(
|
def test_get_slack_repo_config_parses_message_for_new_thread(
|
||||||
|
|
@ -202,8 +200,9 @@ def test_get_slack_repo_config_existing_thread_without_repo_uses_default(
|
||||||
monkeypatch.setattr(webapp, "get_client", lambda url: _FakeClient(threads_client))
|
monkeypatch.setattr(webapp, "get_client", lambda url: _FakeClient(threads_client))
|
||||||
monkeypatch.setattr(webapp, "post_slack_thread_reply", fake_post_slack_thread_reply)
|
monkeypatch.setattr(webapp, "post_slack_thread_reply", fake_post_slack_thread_reply)
|
||||||
|
|
||||||
repo = asyncio.run(
|
repo = asyncio.run(webapp.get_slack_repo_config("please help", "C123", "1.234"))
|
||||||
webapp.get_slack_repo_config("please use repo:new-owner/new-repo", "C123", "1.234")
|
|
||||||
)
|
|
||||||
|
|
||||||
assert repo == {"owner": "default-owner", "name": "default-repo"}
|
assert repo == {"owner": "default-owner", "name": "default-repo"}
|
||||||
|
assert threads_client.requested_thread_id == generate_thread_id_from_slack_thread(
|
||||||
|
"C123", "1.234"
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue