|
1 | 1 | import argparse
|
2 | 2 | import pytest
|
3 | 3 | from typing import Callable, Text
|
4 |
| -from unittest.mock import Mock |
| 4 | +from unittest.mock import Mock, ANY |
5 | 5 |
|
6 | 6 | from _pytest.monkeypatch import MonkeyPatch
|
7 | 7 | from _pytest.pytester import RunResult
|
@@ -158,3 +158,22 @@ def test_no_interactive_without_core_data(
|
158 | 158 |
|
159 | 159 | mock.train_model.assert_not_called()
|
160 | 160 | mock.perform_interactive_learning.assert_not_called()
|
| 161 | + |
| 162 | + |
| 163 | +def test_pass_conversation_id_to_interactive_learning(monkeypatch: MonkeyPatch): |
| 164 | + from rasa.core.train import do_interactive_learning |
| 165 | + from rasa.core.training import interactive as interactive_learning |
| 166 | + |
| 167 | + parser = argparse.ArgumentParser() |
| 168 | + sub_parser = parser.add_subparsers() |
| 169 | + interactive.add_subparser(sub_parser, []) |
| 170 | + |
| 171 | + expected_conversation_id = "🎁" |
| 172 | + args = parser.parse_args(["interactive", "--conversation-id", expected_conversation_id, "--skip-visualization", ]) |
| 173 | + |
| 174 | + _serve_application = Mock() |
| 175 | + monkeypatch.setattr(interactive_learning, "_serve_application", _serve_application) |
| 176 | + |
| 177 | + do_interactive_learning(args, Mock()) |
| 178 | + |
| 179 | + _serve_application.assert_called_once_with(ANY, ANY, True, expected_conversation_id) |
0 commit comments