1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-22 03:49:36 +00:00

Prevent possible secret values to show up in deprecation logs (#36368)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Franck Nijhof
2020-06-02 17:29:59 +02:00
committed by GitHub
parent 37f7d262d7
commit e86bedb223
2 changed files with 24 additions and 29 deletions

View File

@@ -548,8 +548,7 @@ def test_deprecated_with_no_optionals(caplog, schema):
"homeassistant.helpers.config_validation",
]
assert (
"The 'mars' option (with value 'True') is deprecated, "
"please remove it from your configuration"
"The 'mars' option is deprecated, please remove it from your configuration"
) in caplog.text
assert test_data == output
@@ -582,8 +581,7 @@ def test_deprecated_with_replacement_key(caplog, schema):
output = deprecated_schema(test_data.copy())
assert len(caplog.records) == 1
assert (
"The 'mars' option (with value 'True') is deprecated, "
"please replace it with 'jupiter'"
"The 'mars' option is deprecated, please replace it with 'jupiter'"
) in caplog.text
assert {"jupiter": True} == output
@@ -617,7 +615,7 @@ def test_deprecated_with_invalidation_version(caplog, schema, version):
)
message = (
"The 'mars' option (with value 'True') is deprecated, "
"The 'mars' option is deprecated, "
"please remove it from your configuration. "
"This option will become invalid in version 1.0.0"
)
@@ -643,7 +641,7 @@ def test_deprecated_with_invalidation_version(caplog, schema, version):
with pytest.raises(vol.MultipleInvalid) as exc_info:
invalidated_schema(test_data)
assert str(exc_info.value) == (
"The 'mars' option (with value 'True') is deprecated, "
"The 'mars' option is deprecated, "
"please remove it from your configuration. This option will "
"become invalid in version 0.1.0"
)
@@ -671,7 +669,7 @@ def test_deprecated_with_replacement_key_and_invalidation_version(
)
warning = (
"The 'mars' option (with value 'True') is deprecated, "
"The 'mars' option is deprecated, "
"please replace it with 'jupiter'. This option will become "
"invalid in version 1.0.0"
)
@@ -703,7 +701,7 @@ def test_deprecated_with_replacement_key_and_invalidation_version(
with pytest.raises(vol.MultipleInvalid) as exc_info:
invalidated_schema(test_data)
assert str(exc_info.value) == (
"The 'mars' option (with value 'True') is deprecated, "
"The 'mars' option is deprecated, "
"please replace it with 'jupiter'. This option will become "
"invalid in version 0.1.0"
)
@@ -725,8 +723,7 @@ def test_deprecated_with_default(caplog, schema):
assert len(caplog.records) == 1
assert caplog.records[0].name == __name__
assert (
"The 'mars' option (with value 'True') is deprecated, "
"please remove it from your configuration"
"The 'mars' option is deprecated, please remove it from your configuration"
) in caplog.text
assert test_data == output
@@ -759,8 +756,7 @@ def test_deprecated_with_replacement_key_and_default(caplog, schema):
output = deprecated_schema(test_data.copy())
assert len(caplog.records) == 1
assert (
"The 'mars' option (with value 'True') is deprecated, "
"please replace it with 'jupiter'"
"The 'mars' option is deprecated, please replace it with 'jupiter'"
) in caplog.text
assert {"jupiter": True} == output
@@ -792,8 +788,7 @@ def test_deprecated_with_replacement_key_and_default(caplog, schema):
output = deprecated_schema_with_default(test_data.copy())
assert len(caplog.records) == 1
assert (
"The 'mars' option (with value 'True') is deprecated, "
"please replace it with 'jupiter'"
"The 'mars' option is deprecated, please replace it with 'jupiter'"
) in caplog.text
assert {"jupiter": True} == output
@@ -828,7 +823,7 @@ def test_deprecated_with_replacement_key_invalidation_version_default(
output = deprecated_schema(test_data.copy())
assert len(caplog.records) == 1
assert (
"The 'mars' option (with value 'True') is deprecated, "
"The 'mars' option is deprecated, "
"please replace it with 'jupiter'. This option will become "
"invalid in version 1.0.0"
) in caplog.text
@@ -855,7 +850,7 @@ def test_deprecated_with_replacement_key_invalidation_version_default(
with pytest.raises(vol.MultipleInvalid) as exc_info:
invalidated_schema(test_data)
assert str(exc_info.value) == (
"The 'mars' option (with value 'True') is deprecated, "
"The 'mars' option is deprecated, "
"please replace it with 'jupiter'. This option will become "
"invalid in version 0.1.0"
)