aboutsummaryrefslogtreecommitdiff
path: root/lib/python/qmk/tests/test_cli_commands.py
diff options
context:
space:
mode:
authorcodecoffeecode <lyharris8@gmail.com>2020-05-16 13:47:07 -0700
committerGitHub <noreply@github.com>2020-05-16 22:47:07 +0200
commitf125406700785333cd14c4ed74eefaa7dd26f235 (patch)
tree36928e1469c09c559bda1b714115653faf40f434 /lib/python/qmk/tests/test_cli_commands.py
parentafebb6576c0c3119fbbeb5b52d98ad6492e7c834 (diff)
downloadqmk_firmware-f125406700785333cd14c4ed74eefaa7dd26f235.tar.gz
qmk_firmware-f125406700785333cd14c4ed74eefaa7dd26f235.zip
Adding unit tests for list-keymaps command (#7711)
Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com> Co-Authored-By: Erovia <Erovia@users.noreply.github.com>
Diffstat (limited to 'lib/python/qmk/tests/test_cli_commands.py')
-rw-r--r--lib/python/qmk/tests/test_cli_commands.py36
1 files changed, 26 insertions, 10 deletions
diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py
index 3b4e66a21..a93587150 100644
--- a/lib/python/qmk/tests/test_cli_commands.py
+++ b/lib/python/qmk/tests/test_cli_commands.py
@@ -50,21 +50,37 @@ def test_pyformat():
50 assert 'Successfully formatted the python code' in result.stderr 50 assert 'Successfully formatted the python code' in result.stderr
51 51
52 52
53def test_list_keyboards(): 53def test_list_keymaps():
54 result = check_subcommand('list-keyboards') 54 result = check_subcommand('list-keymaps', '-kb', 'handwired/onekey/pytest')
55 assert result.returncode == 0 55 assert result.returncode == 0
56 # check to see if a known keyboard is returned 56 assert 'default' and 'test' in result.stdout
57 # this will fail if handwired/onekey/pytest is removed
58 assert 'handwired/onekey/pytest' in result.stdout
59 57
60 58
61def test_list_keymaps(): 59def test_list_keymaps_long():
62 result = check_subcommand("list-keymaps", "-kb", "handwired/onekey/pytest") 60 result = check_subcommand('list-keymaps', '--keyboard', 'handwired/onekey/pytest')
61 assert result.returncode == 0
62 assert 'default' and 'test' in result.stdout
63
64
65def test_list_keymaps_kb_only():
66 result = check_subcommand('list-keymaps', '-kb', 'niu_mini')
67 assert result.returncode == 0
68 assert 'default' and 'via' in result.stdout
69
70
71def test_list_keymaps_vendor_kb():
72 result = check_subcommand('list-keymaps', '-kb', 'ai03/lunar')
73 assert result.returncode == 0
74 assert 'default' and 'via' in result.stdout
75
76
77def test_list_keymaps_vendor_kb_rev():
78 result = check_subcommand('list-keymaps', '-kb', 'kbdfans/kbd67/mkiirgb/v2')
63 assert result.returncode == 0 79 assert result.returncode == 0
64 assert "default" and "test" in result.stdout 80 assert 'default' and 'via' in result.stdout
65 81
66 82
67def test_list_keymaps_no_keyboard_found(): 83def test_list_keymaps_no_keyboard_found():
68 result = check_subcommand("list-keymaps", "-kb", "asdfghjkl") 84 result = check_subcommand('list-keymaps', '-kb', 'asdfghjkl')
69 assert result.returncode == 0 85 assert result.returncode == 0
70 assert "does not exist" in result.stdout 86 assert 'does not exist' in result.stdout