Test copier correctly processes advanced questions and answers through CLI.
(template_path: str, tmp_path: Path, spawn: Spawn)
| 169 | |
| 170 | |
| 171 | def test_cli_interactive(template_path: str, tmp_path: Path, spawn: Spawn) -> None: |
| 172 | """Test copier correctly processes advanced questions and answers through CLI.""" |
| 173 | tui = spawn(COPIER_PATH + ("copy", template_path, str(tmp_path))) |
| 174 | expect_prompt(tui, "love_me", "bool", help="I need to know it. Do you love me?") |
| 175 | tui.send("y") |
| 176 | expect_prompt(tui, "your_name", "str", help="Please tell me your name.") |
| 177 | tui.sendline("Guybrush Threpwood") |
| 178 | check_invalid(tui, "your_age", "int", "wrong your_age", help="How old are you?") |
| 179 | tui.send((Keyboard.Alt + Keyboard.Backspace) * 2) |
| 180 | tui.send("-1") |
| 181 | tui.expect_exact("Must be +") |
| 182 | tui.send(Keyboard.Backspace * 2) |
| 183 | tui.sendline("22") |
| 184 | check_invalid( |
| 185 | tui, "your_height", "float", "wrong your_height", help="What's your height?" |
| 186 | ) |
| 187 | tui.send((Keyboard.Alt + Keyboard.Backspace) * 2) |
| 188 | tui.sendline("1.56") |
| 189 | check_invalid(tui, "more_json_info", "json", '{"objective":') |
| 190 | tui.sendline('"be a pirate"}') |
| 191 | tui.send(Keyboard.Esc + Keyboard.Enter) |
| 192 | expect_prompt(tui, "anything_else", "yaml", help="Wanna give me any more info?") |
| 193 | tui.sendline("- Want some grog?") |
| 194 | tui.sendline("- I'd love it") |
| 195 | tui.send(Keyboard.Esc + Keyboard.Enter) |
| 196 | expect_prompt(tui, "choose_list", "str", help="You see the value of the list items") |
| 197 | deque( |
| 198 | map( |
| 199 | tui.expect_exact, |
| 200 | [ |
| 201 | "first", |
| 202 | "second", |
| 203 | "third", |
| 204 | ], |
| 205 | ) |
| 206 | ) |
| 207 | tui.sendline() |
| 208 | expect_prompt( |
| 209 | tui, |
| 210 | "choose_tuple", |
| 211 | "str", |
| 212 | help="You see the 1st tuple item, but I get the 2nd item as a result", |
| 213 | ) |
| 214 | deque( |
| 215 | map( |
| 216 | tui.expect_exact, |
| 217 | [ |
| 218 | "one", |
| 219 | "two", |
| 220 | "three", |
| 221 | ], |
| 222 | ) |
| 223 | ) |
| 224 | tui.sendline() |
| 225 | expect_prompt( |
| 226 | tui, "choose_dict", "str", help="You see the dict key, but I get the dict value" |
| 227 | ) |
| 228 | deque( |
nothing calls this directly
no test coverage detected