-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: modify print of configuration to be testable
- Loading branch information
1 parent
64c3302
commit 5510ec6
Showing
3 changed files
with
101 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
[#FFFFFF]Característica: | ||
reliability | ||
[#FFFFFF]Peso: 50% | ||
[#FFFFFF]Subcaracteristica(s): | ||
[#FFFFFF]Fim-Subcaracterística | ||
| | testing_status | ||
| | [#FFFFFF]Peso: 100% | ||
| | [#FFFFFF]Medida(s): | ||
| | [#FFFFFF]Fim-Medida(s) | ||
| | [#FFFFFF]Medida(s): | ||
| | [#FFFFFF]Fim-Medida(s) | ||
| | Medida(s): | ||
| | Fim-Medida(s) | ||
| | | | test_coverage | ||
| | | | Peso: 34% | ||
| | | | Métrica(s): | ||
| | | Valores de referência: Min: 60 e Max: 100 | ||
| | | | Fim-Metrica(s) | ||
| | | | test_builds | ||
| | | | Peso: 33% | ||
| | | | Métrica(s): | ||
| | | Valores de referência: Min: 0 e Max: 300000 | ||
| | | | Fim-Metrica(s) | ||
| | | | passed_tests | ||
| | | | Peso: 33% | ||
| | | | Métrica(s): | ||
| | | Valores de referência: Min: 0 e Max: 1 | ||
| | | | Fim-Metrica(s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import unittest | ||
from unittest.mock import patch | ||
from io import StringIO | ||
import sys | ||
import json | ||
|
||
from src.cli.commands.cmd_print_config import print_json_tree | ||
from src.cli.utils import print_info, print_rule | ||
|
||
|
||
def test_print_json_tree(): | ||
|
||
file = open("tests/unit/data/msgram.json") | ||
data = json.load(file) | ||
|
||
captured_output = StringIO() | ||
sys.stdout = captured_output | ||
|
||
characteristics = data.get("characteristics", []) | ||
|
||
result = print_json_tree(characteristics[0]) | ||
|
||
fileExpected = open("tests/unit/data/expected_list.txt") | ||
|
||
compare = fileExpected.read() | ||
|
||
assert result == compare |