MCPcopy Index your code
hub / github.com/StackStorm/st2 / test_arrayreader

Method test_arrayreader

st2client/tests/unit/test_interactive.py:254–270  ·  view source on GitHub ↗
(self, prompt_mock)

Source from the content-addressed store, hash-verified

252
253 @mock.patch.object(interactive, "prompt")
254 def test_arrayreader(self, prompt_mock):
255 spec = {"description": "some description", "default": ["a", "b"]}
256 Reader = interactive.ArrayReader("some", spec)
257
258 prompt_mock.return_value = "some,thing,else"
259 result = Reader.read()
260
261 self.assertEqual(result, ["some", "thing", "else"])
262 self.assertPromptMessage(prompt_mock, "some (comma-separated list) [a,b]: ")
263 self.assertPromptDescription(prompt_mock, "some description")
264 self.assertPromptValidate(prompt_mock, "some,thing,else")
265
266 prompt_mock.return_value = ""
267 result = Reader.read()
268
269 self.assertEqual(result, ["a", "b"])
270 self.assertPromptValidate(prompt_mock, "")
271
272 @mock.patch.object(interactive, "prompt")
273 def test_arrayreader_ends_with_comma(self, prompt_mock):

Callers

nothing calls this directly

Calls 4

readMethod · 0.95
assertPromptMessageMethod · 0.95
assertPromptValidateMethod · 0.95

Tested by

no test coverage detected