mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-25 21:36:52 +08:00
Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: Engel Nyst <engel.nyst@gmail.com> Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
26 lines
660 B
Python
26 lines
660 B
Python
from unittest.mock import MagicMock
|
|
|
|
import pytest
|
|
from integrations.slack.slack_manager import SlackManager
|
|
|
|
|
|
@pytest.fixture
|
|
def slack_manager():
|
|
# Mock the token_manager constructor
|
|
slack_manager = SlackManager(token_manager=MagicMock())
|
|
return slack_manager
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
'message,expected',
|
|
[
|
|
('OpenHands/Openhands', 'OpenHands/Openhands'),
|
|
('deploy repo', 'deploy'),
|
|
('use hello world', None),
|
|
],
|
|
)
|
|
def test_infer_repo_from_message(message, expected, slack_manager):
|
|
# Test the extracted function
|
|
result = slack_manager._infer_repo_from_message(message)
|
|
assert result == expected
|