add password authentication for bot users
This commit is contained in:
@@ -67,5 +67,25 @@ class AssistantModeConfigTests(unittest.TestCase):
|
||||
)
|
||||
|
||||
|
||||
class PasswordConfigTests(unittest.TestCase):
|
||||
def test_password_is_required(self) -> None:
|
||||
with patch("assistant_bot.config.load_env_file"), patch.dict(
|
||||
os.environ,
|
||||
{},
|
||||
clear=False,
|
||||
):
|
||||
os.environ.pop(config.PASSWORD_ENV_NAME, None)
|
||||
with self.assertRaises(RuntimeError):
|
||||
config.get_assistant_password()
|
||||
|
||||
def test_password_is_read_from_environment(self) -> None:
|
||||
with patch("assistant_bot.config.load_env_file"), patch.dict(
|
||||
os.environ,
|
||||
{config.PASSWORD_ENV_NAME: " test-password "},
|
||||
clear=False,
|
||||
):
|
||||
self.assertEqual(config.get_assistant_password(), "test-password")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user