From 1cf026d9568b228cc6494ec4c4b6751290154674 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 17 Apr 2015 15:32:33 +0100 Subject: [PATCH] Fix platform tests according refactor changes --- tests/commands/test_list.py | 22 ----------------- tests/commands/test_platforms.py | 42 ++++++++++++++++++++++++++++++++ tests/commands/test_search.py | 22 ----------------- 3 files changed, 42 insertions(+), 44 deletions(-) delete mode 100644 tests/commands/test_list.py create mode 100644 tests/commands/test_platforms.py delete mode 100644 tests/commands/test_search.py diff --git a/tests/commands/test_list.py b/tests/commands/test_list.py deleted file mode 100644 index e40b5926..00000000 --- a/tests/commands/test_list.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) Ivan Kravets -# See LICENSE for details. - -import json - -from platformio.commands.list import cli - - -def test_list_json_output(clirunner, validate_cliresult): - result = clirunner.invoke(cli, ["--json-output"]) - validate_cliresult(result) - list_result = json.loads(result.output) - assert isinstance(list_result, list) - assert len(list_result) - platforms = [item['name'] for item in list_result] - assert "titiva" in platforms - - -def test_list_raw_output(clirunner, validate_cliresult): - result = clirunner.invoke(cli) - validate_cliresult(result) - assert "teensy" in result.output diff --git a/tests/commands/test_platforms.py b/tests/commands/test_platforms.py new file mode 100644 index 00000000..310967a2 --- /dev/null +++ b/tests/commands/test_platforms.py @@ -0,0 +1,42 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +import json + +from platformio.commands.platforms import \ + platforms_list as cmd_platforms_list +from platformio.commands.platforms import \ + platforms_search as cmd_platforms_search + + +def test_list_json_output(clirunner, validate_cliresult): + result = clirunner.invoke(cmd_platforms_list, ["--json-output"]) + validate_cliresult(result) + list_result = json.loads(result.output) + assert isinstance(list_result, list) + assert len(list_result) + platforms = [item['name'] for item in list_result] + assert "titiva" in platforms + + +def test_list_raw_output(clirunner, validate_cliresult): + result = clirunner.invoke(cmd_platforms_list) + validate_cliresult(result) + assert "teensy" in result.output + + +def test_search_json_output(clirunner, validate_cliresult): + result = clirunner.invoke(cmd_platforms_search, + ["arduino", "--json-output"]) + validate_cliresult(result) + search_result = json.loads(result.output) + assert isinstance(search_result, list) + assert len(search_result) + platforms = [item['type'] for item in search_result] + assert "atmelsam" in platforms + + +def test_search_raw_output(clirunner, validate_cliresult): + result = clirunner.invoke(cmd_platforms_search, ["arduino"]) + validate_cliresult(result) + assert "teensy" in result.output diff --git a/tests/commands/test_search.py b/tests/commands/test_search.py deleted file mode 100644 index 4179f1b2..00000000 --- a/tests/commands/test_search.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) Ivan Kravets -# See LICENSE for details. - -import json - -from platformio.commands.search import cli - - -def test_search_json_output(clirunner, validate_cliresult): - result = clirunner.invoke(cli, ["arduino", "--json-output"]) - validate_cliresult(result) - search_result = json.loads(result.output) - assert isinstance(search_result, list) - assert len(search_result) - platforms = [item['type'] for item in search_result] - assert "atmelsam" in platforms - - -def test_search_raw_output(clirunner, validate_cliresult): - result = clirunner.invoke(cli, ["arduino"]) - validate_cliresult(result) - assert "teensy" in result.output