diff options
Diffstat (limited to 'lib/python/qmk/tests')
-rw-r--r-- | lib/python/qmk/tests/minimal_info.json | 13 | ||||
-rw-r--r-- | lib/python/qmk/tests/minimal_keymap.json | 7 | ||||
-rw-r--r-- | lib/python/qmk/tests/pytest_export.json | 6 | ||||
-rw-r--r-- | lib/python/qmk/tests/test_cli_commands.py | 24 |
4 files changed, 44 insertions, 6 deletions
diff --git a/lib/python/qmk/tests/minimal_info.json b/lib/python/qmk/tests/minimal_info.json new file mode 100644 index 000000000..b91c23bd3 --- /dev/null +++ b/lib/python/qmk/tests/minimal_info.json | |||
@@ -0,0 +1,13 @@ | |||
1 | { | ||
2 | "keyboard_name": "tester", | ||
3 | "maintainer": "qmk", | ||
4 | "height": 5, | ||
5 | "width": 15, | ||
6 | "layouts": { | ||
7 | "LAYOUT": { | ||
8 | "layout": [ | ||
9 | { "label": "KC_A", "x": 0, "y": 0, "matrix": [0, 0] } | ||
10 | ] | ||
11 | } | ||
12 | } | ||
13 | } | ||
diff --git a/lib/python/qmk/tests/minimal_keymap.json b/lib/python/qmk/tests/minimal_keymap.json new file mode 100644 index 000000000..258f9e8a9 --- /dev/null +++ b/lib/python/qmk/tests/minimal_keymap.json | |||
@@ -0,0 +1,7 @@ | |||
1 | { | ||
2 | "keyboard": "handwired/pytest/basic", | ||
3 | "keymap": "test", | ||
4 | "layers": [["KC_A"]], | ||
5 | "layout": "LAYOUT_ortho_1x1", | ||
6 | "version": 1 | ||
7 | } | ||
diff --git a/lib/python/qmk/tests/pytest_export.json b/lib/python/qmk/tests/pytest_export.json deleted file mode 100644 index 5fb0d624f..000000000 --- a/lib/python/qmk/tests/pytest_export.json +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | { | ||
2 | "keyboard":"handwired/pytest/basic", | ||
3 | "keymap":"pytest_unittest", | ||
4 | "layout":"LAYOUT", | ||
5 | "layers":[["KC_A"]] | ||
6 | } | ||
diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py index b16777e54..0a87f60e0 100644 --- a/lib/python/qmk/tests/test_cli_commands.py +++ b/lib/python/qmk/tests/test_cli_commands.py | |||
@@ -259,3 +259,27 @@ def test_generate_layouts(): | |||
259 | result = check_subcommand('generate-layouts', '-kb', 'handwired/pytest/basic') | 259 | result = check_subcommand('generate-layouts', '-kb', 'handwired/pytest/basic') |
260 | check_returncode(result) | 260 | check_returncode(result) |
261 | assert '#define LAYOUT_custom(k0A) {' in result.stdout | 261 | assert '#define LAYOUT_custom(k0A) {' in result.stdout |
262 | |||
263 | |||
264 | def test_format_json_keyboard(): | ||
265 | result = check_subcommand('format-json', '--format', 'keyboard', 'lib/python/qmk/tests/minimal_info.json') | ||
266 | check_returncode(result) | ||
267 | assert result.stdout == '{\n "keyboard_name": "tester",\n "maintainer": "qmk",\n "height": 5,\n "width": 15,\n "layouts": {\n "LAYOUT": {\n "layout": [\n { "label": "KC_A", "matrix": [0, 0], "x": 0, "y": 0 }\n ]\n }\n }\n}\n' | ||
268 | |||
269 | |||
270 | def test_format_json_keymap(): | ||
271 | result = check_subcommand('format-json', '--format', 'keymap', 'lib/python/qmk/tests/minimal_keymap.json') | ||
272 | check_returncode(result) | ||
273 | assert result.stdout == '{\n "version": 1,\n "keyboard": "handwired/pytest/basic",\n "keymap": "test",\n "layout": "LAYOUT_ortho_1x1",\n "layers": [\n [\n "KC_A"\n ]\n ]\n}\n' | ||
274 | |||
275 | |||
276 | def test_format_json_keyboard_auto(): | ||
277 | result = check_subcommand('format-json', '--format', 'auto', 'lib/python/qmk/tests/minimal_info.json') | ||
278 | check_returncode(result) | ||
279 | assert result.stdout == '{\n "keyboard_name": "tester",\n "maintainer": "qmk",\n "height": 5,\n "width": 15,\n "layouts": {\n "LAYOUT": {\n "layout": [\n { "label": "KC_A", "matrix": [0, 0], "x": 0, "y": 0 }\n ]\n }\n }\n}\n' | ||
280 | |||
281 | |||
282 | def test_format_json_keymap_auto(): | ||
283 | result = check_subcommand('format-json', '--format', 'auto', 'lib/python/qmk/tests/minimal_keymap.json') | ||
284 | check_returncode(result) | ||
285 | assert result.stdout == '{\n "keyboard": "handwired/pytest/basic",\n "keymap": "test",\n "layers": [\n ["KC_A"]\n ],\n "layout": "LAYOUT_ortho_1x1",\n "version": 1\n}\n' | ||