Skip to content

Commit 940c6e8

Browse files
committed
Fix #125: Update keys test to use feed and process_keys
feed_key was separated to feed and process_keys in prompt-toolkit 1.0.1.
1 parent dd736a3 commit 940c6e8

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tests/integration/test_keys.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,34 @@ def setUp(self):
2727
self.aws_shell = AWSShell(None, mock.Mock(), mock.Mock())
2828
self.processor = self.aws_shell.cli.input_processor
2929

30+
def feed_key(self, key):
31+
self.processor.feed(KeyPress(key, u''))
32+
self.processor.process_keys()
33+
3034
def test_F2(self):
3135
match_fuzzy = self.aws_shell.model_completer.match_fuzzy
32-
self.processor.feed_key(KeyPress(Keys.F2, ''))
36+
self.feed_key(Keys.F2)
3337
assert match_fuzzy != self.aws_shell.model_completer.match_fuzzy
3438

3539
def test_F3(self):
3640
enable_vi_bindings = self.aws_shell.enable_vi_bindings
3741
with self.assertRaises(InputInterrupt):
38-
self.processor.feed_key(KeyPress(Keys.F3, ''))
42+
self.feed_key(Keys.F3)
3943
assert enable_vi_bindings != self.aws_shell.enable_vi_bindings
4044

4145
def test_F4(self):
4246
show_completion_columns = self.aws_shell.show_completion_columns
4347
with self.assertRaises(InputInterrupt):
44-
self.processor.feed_key(KeyPress(Keys.F4, ''))
48+
self.feed_key(Keys.F4)
4549
assert show_completion_columns != \
4650
self.aws_shell.show_completion_columns
4751

4852
def test_F5(self):
4953
show_help = self.aws_shell.show_help
5054
with self.assertRaises(InputInterrupt):
51-
self.processor.feed_key(KeyPress(Keys.F5, ''))
55+
self.feed_key(Keys.F5)
5256
assert show_help != self.aws_shell.show_help
5357

5458
def test_F10(self):
55-
self.processor.feed_key(KeyPress(Keys.F10, ''))
59+
self.feed_key(Keys.F10)
5660
assert self.aws_shell.cli.is_exiting

0 commit comments

Comments
 (0)