Add support for using credstash as a secret store (#8494)
This commit is contained in:
parent
9d9ca64f26
commit
98568b5eb7
5 changed files with 104 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
import io
|
||||
import os
|
||||
import unittest
|
||||
import logging
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
@ -372,6 +373,16 @@ class TestSecrets(unittest.TestCase):
|
|||
_yaml = load_yaml(self._yaml_path, yaml_str)
|
||||
self.assertEqual({'http': {'api_password': 'yeah'}}, _yaml)
|
||||
|
||||
@patch.object(yaml, 'credstash')
|
||||
def test_secrets_credstash(self, mock_credstash):
|
||||
"""Test credstash fallback & get_password."""
|
||||
mock_credstash.getSecret.return_value = 'yeah'
|
||||
yaml_str = 'http:\n api_password: !secret http_pw_credstash'
|
||||
_yaml = load_yaml(self._yaml_path, yaml_str)
|
||||
log = logging.getLogger()
|
||||
log.error(_yaml['http'])
|
||||
self.assertEqual({'api_password': 'yeah'}, _yaml['http'])
|
||||
|
||||
def test_secrets_logger_removed(self):
|
||||
"""Ensure logger: debug was removed."""
|
||||
with self.assertRaises(yaml.HomeAssistantError):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue