diff --git a/src/rougail/output_display/config.py b/src/rougail/output_display/config.py
index 3aace30..ea516de 100644
--- a/src/rougail/output_display/config.py
+++ b/src/rougail/output_display/config.py
@@ -17,18 +17,71 @@ along with this program. If not, see
+Variables: +┗━ 📂 A family + ┣━ 📓 The first variable: string1 ◀ loaded from rougail-test + ┗━ 📓 The second variable: string1 ◀ loaded from rougail-test ++ +
+Variables: +┣━━ 📓 Configure Proxy Access to the Internet: No proxy +┗━━ 📂 Manual proxy configuration + ┗━━ 📂 HTTP Proxy + ┗━━ 📓 HTTP address: example.net ◀ loaded from the YAML file + "config/03/config.yml" ++ + +> Variables: +> - 📂 A family +> - 📓 The first variable: string1 ◀ loaded from rougail-test +> - 📓 The second variable: string1 ◀ loaded from rougail-test + diff --git a/tests/errors-results/console.sh b/tests/errors-results/console.sh deleted file mode 100644 index b390d88..0000000 --- a/tests/errors-results/console.sh +++ /dev/null @@ -1,3 +0,0 @@ -[1;91m🛑 ERRORS[0m -[91m┗━━ [0mThe following variables are inaccessible but are empty and mandatory: -[91m [0m[91m┗━━ [0mmandatory_variable (please set a value) diff --git a/tests/errors-results/display.md b/tests/errors-results/display.md new file mode 100644 index 0000000..5910810 --- /dev/null +++ b/tests/errors-results/display.md @@ -0,0 +1,4 @@ +> [!CAUTION] +> +> - please set a value: :stop_sign: mandatory variable but is inaccessible and has no value + diff --git a/tests/errors-results/display.sh b/tests/errors-results/display.sh index 0c44310..8ab16c0 100644 --- a/tests/errors-results/display.sh +++ b/tests/errors-results/display.sh @@ -1,3 +1,2 @@ [1;91m🛑 ERRORS[0m -[91m┗━━ [0mThe following variables are inaccessible but are empty and mandatory: -[91m [0m[91m┗━━ [0mplease set a value +[91m┗━━ [0mplease set a value: mandatory variable but is inaccessible and has no value diff --git a/tests/errors2-results/display.md b/tests/errors2-results/display.md new file mode 100644 index 0000000..2ec6b4c --- /dev/null +++ b/tests/errors2-results/display.md @@ -0,0 +1,6 @@ +> [!CAUTION] +> +> - family1 +> - family2 +> - please set a value: :stop_sign: mandatory variable but is inaccessible and has no value + diff --git a/tests/errors2-results/display.sh b/tests/errors2-results/display.sh index bfbcff3..1929ccb 100644 --- a/tests/errors2-results/display.sh +++ b/tests/errors2-results/display.sh @@ -1,5 +1,4 @@ [1;91m🛑 ERRORS[0m -[91m┗━━ [0mThe following variables are inaccessible but are empty and mandatory: -[91m [0m[91m┗━━ [0mfamily1 -[91m [0m[91m [0m[91m┗━━ [0mfamily2 -[91m [0m[91m [0m[91m [0m[91m┗━━ [0mplease set a value +[91m┗━━ [0mfamily1 +[91m [0m[91m┗━━ [0mfamily2 +[91m [0m[91m [0m[91m┗━━ [0mplease set a value: mandatory variable but is inaccessible and has no value diff --git a/tests/errors3-results/display.md b/tests/errors3-results/display.md new file mode 100644 index 0000000..de8bf49 --- /dev/null +++ b/tests/errors3-results/display.md @@ -0,0 +1,6 @@ +> [!CAUTION] +> +> - family1 +> - family2 +> - please set a value: :stop_sign: mandatory variable but has no value + diff --git a/tests/errors3-results/display.sh b/tests/errors3-results/display.sh index 20453a6..b788786 100644 --- a/tests/errors3-results/display.sh +++ b/tests/errors3-results/display.sh @@ -1,5 +1,4 @@ [1;91m🛑 ERRORS[0m -[91m┗━━ [0mThe following variables are mandatory but have no value: -[91m [0m[91m┗━━ [0mfamily1 -[91m [0m[91m [0m[91m┗━━ [0mfamily2 -[91m [0m[91m [0m[91m [0m[91m┗━━ [0mplease set a value +[91m┗━━ [0mfamily1 +[91m [0m[91m┗━━ [0mfamily2 +[91m [0m[91m [0m[91m┗━━ [0mplease set a value: mandatory variable but has no value diff --git a/tests/errors4-results/display.md b/tests/errors4-results/display.md new file mode 100644 index 0000000..16e6836 --- /dev/null +++ b/tests/errors4-results/display.md @@ -0,0 +1,6 @@ +> [!CAUTION] +> +> - family1 +> - family2 +> - A variable: :stop_sign: "not_an_integer" is an invalid integer + diff --git a/tests/errors4-results/display.sh b/tests/errors4-results/display.sh new file mode 100644 index 0000000..f50edd5 --- /dev/null +++ b/tests/errors4-results/display.sh @@ -0,0 +1,4 @@ +[1;91m🛑 ERRORS[0m +[91m┗━━ [0mfamily1 +[91m [0m[91m┗━━ [0mfamily2 +[91m [0m[91m [0m[91m┗━━ [0mA variable: "not_an_integer" is an invalid integer diff --git a/tests/errors4/rougail/00-file.yml b/tests/errors4/rougail/00-file.yml new file mode 100644 index 0000000..e375d40 --- /dev/null +++ b/tests/errors4/rougail/00-file.yml @@ -0,0 +1,15 @@ +%YAML 1.2 +--- +version: 1.1 + +family1: + + family2: + + variable: + description: A variable + type: integer + default: + jinja: |- + not_an_integer +... diff --git a/tests/errors5-results/display.md b/tests/errors5-results/display.md new file mode 100644 index 0000000..db39a20 --- /dev/null +++ b/tests/errors5-results/display.md @@ -0,0 +1,6 @@ +> [!CAUTION] +> +> - my family1 +> - my integer: :stop_sign: the value "not_an_integer" is an invalid integer, it's not an integer, it has been loading from fake user data +> - my string: :stop_sign: the value "3" is an invalid string, it's not a string, it has been loading from fake user data + diff --git a/tests/errors5-results/display.sh b/tests/errors5-results/display.sh new file mode 100644 index 0000000..0d2fb5f --- /dev/null +++ b/tests/errors5-results/display.sh @@ -0,0 +1,4 @@ +[1;91m🛑 ERRORS[0m +[91m┗━━ [0mmy family1 +[91m [0m[91m┣━━ [0mmy integer: the value "not_an_integer" is an invalid integer, it's not an integer, it has been loading from fake user data +[91m [0m[91m┗━━ [0mmy string: the value "3" is an invalid string, it's not a string, it has been loading from fake user data diff --git a/tests/errors5/rougail/00-file.yml b/tests/errors5/rougail/00-file.yml new file mode 100644 index 0000000..8368c17 --- /dev/null +++ b/tests/errors5/rougail/00-file.yml @@ -0,0 +1,12 @@ +%YAML 1.2 +--- +version: 1.1 + +family1: # my family1 + + integer: + description: my integer + type: integer + + string: # my string +... diff --git a/tests/errors6-results/display.md b/tests/errors6-results/display.md new file mode 100644 index 0000000..35ac55b --- /dev/null +++ b/tests/errors6-results/display.md @@ -0,0 +1,5 @@ +> [!CAUTION] +> +> - cannot load variable path "dynVal3.val", the identifier "Val3" is not valid in fake user data +> - variable or family "dynVal3" does not exist, it has been loading from fake user data + diff --git a/tests/errors6-results/display.sh b/tests/errors6-results/display.sh new file mode 100644 index 0000000..322fbd8 --- /dev/null +++ b/tests/errors6-results/display.sh @@ -0,0 +1,3 @@ +[1;91m🛑 ERRORS[0m +[91m┣━━ [0mcannot load variable path "dynVal3.val", the identifier "Val3" is not valid in fake user data +[91m┗━━ [0mvariable or family "dynVal3" does not exist, it has been loading from fake user data diff --git a/tests/errors6/rougail/00-file.yml b/tests/errors6/rougail/00-file.yml new file mode 100644 index 0000000..3d90c44 --- /dev/null +++ b/tests/errors6/rougail/00-file.yml @@ -0,0 +1,13 @@ +%YAML 1.2 +--- +version: 1.1 + +dyn{{ identifier }}: + description: A dynamic with {{ identifier }} + dynamic: + - val1 + - val2 + + val: + description: val with {{ identifier }} +... diff --git a/tests/errors7-results/display.md b/tests/errors7-results/display.md new file mode 100644 index 0000000..9b4054f --- /dev/null +++ b/tests/errors7-results/display.md @@ -0,0 +1,5 @@ +> [!CAUTION] +> +> - family1 +> - this variable is in fact a family: :stop_sign: is a family so we cannot set the value "value", it has been loading from fake user data + diff --git a/tests/errors7-results/display.sh b/tests/errors7-results/display.sh new file mode 100644 index 0000000..86b45a6 --- /dev/null +++ b/tests/errors7-results/display.sh @@ -0,0 +1,3 @@ +[1;91m🛑 ERRORS[0m +[91m┗━━ [0mfamily1 +[91m [0m[91m┗━━ [0mthis variable is in fact a family: is a family so we cannot set the value "value", it has been loading from fake user data diff --git a/tests/errors7-results/display_warnings.md b/tests/errors7-results/display_warnings.md new file mode 100644 index 0000000..fcda753 --- /dev/null +++ b/tests/errors7-results/display_warnings.md @@ -0,0 +1,11 @@ +> [!WARNING] +> +> - family1 +> - this variable is in fact a family: :bell: is a family so we cannot set the value "value", it will be ignored when loading from fake user data + +> [!CAUTION] +> +> - family1 +> - this variable is in fact a family +> - a true variable: :stop_sign: mandatory variable but has no value + diff --git a/tests/errors7-results/display_warnings.sh b/tests/errors7-results/display_warnings.sh new file mode 100644 index 0000000..d0a77f8 --- /dev/null +++ b/tests/errors7-results/display_warnings.sh @@ -0,0 +1,7 @@ +[1;93m🔔 WARNINGS[0m +[93m┗━━ [0mfamily1 +[93m [0m[93m┗━━ [0mthis variable is in fact a family: is a family so we cannot set the value "value", it will be ignored when loading from fake user data +[1;91m🛑 ERRORS[0m +[91m┗━━ [0mfamily1 +[91m [0m[91m┗━━ [0mthis variable is in fact a family +[91m [0m[91m [0m[91m┗━━ [0ma true variable: mandatory variable but has no value diff --git a/tests/errors7/rougail/00-file.yml b/tests/errors7/rougail/00-file.yml new file mode 100644 index 0000000..69ccd38 --- /dev/null +++ b/tests/errors7/rougail/00-file.yml @@ -0,0 +1,10 @@ +%YAML 1.2 +--- +version: 1.1 + +family1: + + variable: # this variable is in fact a family + + true_variable: # a true variable +... diff --git a/tests/errors8-results/display.md b/tests/errors8-results/display.md new file mode 100644 index 0000000..4bfe40b --- /dev/null +++ b/tests/errors8-results/display.md @@ -0,0 +1,4 @@ +> [!CAUTION] +> +> - variable or family "dyn{{ identifier }}.var" does not exist, it has been loading from fake user data + diff --git a/tests/errors8-results/display.sh b/tests/errors8-results/display.sh new file mode 100644 index 0000000..be3ef3b --- /dev/null +++ b/tests/errors8-results/display.sh @@ -0,0 +1,2 @@ +[1;91m🛑 ERRORS[0m +[91m┗━━ [0mvariable or family "dyn{{ identifier }}.var" does not exist, it has been loading from fake user data diff --git a/tests/errors9-results/display.md b/tests/errors9-results/display.md new file mode 100644 index 0000000..b008bcc --- /dev/null +++ b/tests/errors9-results/display.md @@ -0,0 +1,7 @@ +> [!CAUTION] +> +> - my family1 +> - my family2 +> - my integer: :stop_sign: the value "not_an_integer" is an invalid integer, it's not an integer, it has been loading from fake user data +> - my string: :stop_sign: the value "3" is an invalid string, it's not a string, it has been loading from fake user data + diff --git a/tests/errors9-results/display.sh b/tests/errors9-results/display.sh new file mode 100644 index 0000000..0892cb7 --- /dev/null +++ b/tests/errors9-results/display.sh @@ -0,0 +1,5 @@ +[1;91m🛑 ERRORS[0m +[91m┗━━ [0mmy family1 +[91m [0m[91m┣━━ [0mmy family2 +[91m [0m[91m┃ [0m[91m┗━━ [0mmy integer: the value "not_an_integer" is an invalid integer, it's not an integer, it has been loading from fake user data +[91m [0m[91m┗━━ [0mmy string: the value "3" is an invalid string, it's not a string, it has been loading from fake user data diff --git a/tests/results/test/00_6boolean.md b/tests/results/test/00_6boolean.md new file mode 100644 index 0000000..6e8a15c --- /dev/null +++ b/tests/results/test/00_6boolean.md @@ -0,0 +1,7 @@ +Variables: +- :notebook: the first variable: true :arrow_backward: loaded from rougail-test (:hourglass_flowing_sand: true) +- :notebook: the second variable: true :arrow_backward: loaded from rougail-test (:hourglass_flowing_sand: true) +- :notebook: the third variable: true :arrow_backward: loaded from rougail-test (:hourglass_flowing_sand: true) +- :notebook: the forth variable: true :arrow_backward: loaded from rougail-test (:hourglass_flowing_sand: false) +- :notebook: the fifth variable: true :arrow_backward: loaded from rougail-test (:hourglass_flowing_sand: false) +- :notebook: the sixth variable: true :arrow_backward: loaded from rougail-test (:hourglass_flowing_sand: false) diff --git a/tests/results/test_namespace/00_6boolean.md b/tests/results/test_namespace/00_6boolean.md new file mode 100644 index 0000000..3675e3e --- /dev/null +++ b/tests/results/test_namespace/00_6boolean.md @@ -0,0 +1,15 @@ +> [!NOTE] +> +> **Caption:** +> - Variable +> - Modified value +> - (:hourglass_flowing_sand: Original default value) + +Variables: +- :open_file_folder: Rougail + - :notebook: the first variable: true ◀ loaded from rougail-test (:hourglass_flowing_sand: true) + - :notebook: the second variable: true ◀ loaded from rougail-test (:hourglass_flowing_sand: true) + - :notebook: the third variable: true ◀ loaded from rougail-test (:hourglass_flowing_sand: true) + - :notebook: the forth variable: true ◀ loaded from rougail-test (:hourglass_flowing_sand: false) + - :notebook: the fifth variable: true ◀ loaded from rougail-test (:hourglass_flowing_sand: false) + - :notebook: the sixth variable: true ◀ loaded from rougail-test (:hourglass_flowing_sand: false) diff --git a/tests/results/test_secrets/00_6boolean.md b/tests/results/test_secrets/00_6boolean.md new file mode 100644 index 0000000..04e7c77 --- /dev/null +++ b/tests/results/test_secrets/00_6boolean.md @@ -0,0 +1,6 @@ +- :notebook: the first variable: true :arrow_backward: loaded from rougail-test (:hourglass_flowing_sand: true) +- :notebook: the second variable: true :arrow_backward: loaded from rougail-test (:hourglass_flowing_sand: true) +- :notebook: the third variable: true :arrow_backward: loaded from rougail-test (:hourglass_flowing_sand: true) +- :notebook: the forth variable: true :arrow_backward: loaded from rougail-test (:hourglass_flowing_sand: false) +- :notebook: the fifth variable: true :arrow_backward: loaded from rougail-test (:hourglass_flowing_sand: false) +- :notebook: the sixth variable: true :arrow_backward: loaded from rougail-test (:hourglass_flowing_sand: false) diff --git a/tests/test_errors.py b/tests/test_errors.py index 66e27a4..4eceee8 100644 --- a/tests/test_errors.py +++ b/tests/test_errors.py @@ -4,6 +4,8 @@ from rougail.output_display import RougailOutputDisplay as RougailOutput from rougail_tests.utils import get_rougail_config +EXT = {'console': 'sh', 'github': 'md'} + def test_error_mandatory_hidden(): rougailconfig = get_rougail_config(Path("tests/errors/"), namespace=False) @@ -12,17 +14,19 @@ def test_error_mandatory_hidden(): config = rougail.run() config.information.set("description_type", "description") config.property.read_only() - no_pb, generated_output = RougailOutput(config, rougailconfig=rougailconfig).run() - assert no_pb == False - output_file = Path(__file__).parent / 'errors-results' / 'display.sh' - if not output_file.is_file(): - if not output_file.parent.is_dir(): - output_file.parent.mkdir() - with output_file.open('w') as outfh: - outfh.write(generated_output) - with output_file.open() as outfh: - attented_output = outfh.read() - assert generated_output == attented_output, f'filename {output_file}' + for output_format, ext in EXT.items(): + rougailconfig['display.output_format'] = output_format + no_pb, generated_output = RougailOutput(config, rougailconfig=rougailconfig).run() + assert no_pb == False + output_file = Path(__file__).parent / 'errors-results' / f'display.{ext}' + if not output_file.is_file(): + if not output_file.parent.is_dir(): + output_file.parent.mkdir() + with output_file.open('w') as outfh: + outfh.write(generated_output) + with output_file.open() as outfh: + attented_output = outfh.read() + assert generated_output == attented_output, f'filename {output_file}' def test_error_mandatory_family_hidden(): @@ -32,17 +36,19 @@ def test_error_mandatory_family_hidden(): config = rougail.run() config.information.set("description_type", "description") config.property.read_only() - no_pb, generated_output = RougailOutput(config, rougailconfig=rougailconfig).run() - assert no_pb == False - output_file = Path(__file__).parent / 'errors2-results' / 'display.sh' - if not output_file.is_file(): - if not output_file.parent.is_dir(): - output_file.parent.mkdir() - with output_file.open('w') as outfh: - outfh.write(generated_output) - with output_file.open() as outfh: - attented_output = outfh.read() - assert generated_output == attented_output, f'filename {output_file}' + for output_format, ext in EXT.items(): + rougailconfig['display.output_format'] = output_format + no_pb, generated_output = RougailOutput(config, rougailconfig=rougailconfig).run() + assert no_pb == False + output_file = Path(__file__).parent / 'errors2-results' / f'display.{ext}' + if not output_file.is_file(): + if not output_file.parent.is_dir(): + output_file.parent.mkdir() + with output_file.open('w') as outfh: + outfh.write(generated_output) + with output_file.open() as outfh: + attented_output = outfh.read() + assert generated_output == attented_output, f'filename {output_file}' def test_error_mandatory_family(): @@ -52,14 +58,16 @@ def test_error_mandatory_family(): config = rougail.run() config.information.set("description_type", "description") config.property.read_only() - no_pb, generated_output = RougailOutput(config, rougailconfig=rougailconfig).run() - assert no_pb == False - output_file = Path(__file__).parent / 'errors3-results' / 'display.sh' - if not output_file.is_file(): - if not output_file.parent.is_dir(): - output_file.parent.mkdir() - with output_file.open('w') as outfh: - outfh.write(generated_output) - with output_file.open() as outfh: - attented_output = outfh.read() - assert generated_output == attented_output, f'filename {output_file}' + for output_format, ext in EXT.items(): + rougailconfig['display.output_format'] = output_format + no_pb, generated_output = RougailOutput(config, rougailconfig=rougailconfig).run() + assert no_pb == False + output_file = Path(__file__).parent / 'errors3-results' / f'display.{ext}' + if not output_file.is_file(): + if not output_file.parent.is_dir(): + output_file.parent.mkdir() + with output_file.open('w') as outfh: + outfh.write(generated_output) + with output_file.open() as outfh: + attented_output = outfh.read() + assert generated_output == attented_output, f'filename {output_file}'