MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / test_read_secret

Function test_read_secret

tests/test_cmd2.py:2238–2249  ·  view source on GitHub ↗

Test read_secret passes is_password=True to _read_raw_input.

(base_app, monkeypatch)

Source from the content-addressed store, hash-verified

2236
2237
2238def test_read_secret(base_app, monkeypatch):
2239 """Test read_secret passes is_password=True to _read_raw_input."""
2240 with mock.patch.object(base_app, "_read_raw_input") as mock_reader:
2241 mock_reader.return_value = "my_secret"
2242
2243 secret = base_app.read_secret("Secret: ")
2244
2245 assert secret == "my_secret"
2246 # Verify it called _read_raw_input with is_password=True
2247 args, kwargs = mock_reader.call_args
2248 assert args[0] == "Secret: "
2249 assert kwargs["is_password"] is True
2250
2251
2252def test_read_secret_eof(base_app, monkeypatch):

Callers

nothing calls this directly

Calls 1

read_secretMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…