20 lines
665 B
Python
20 lines
665 B
Python
import os
|
|
import unittest
|
|
from unittest import mock
|
|
|
|
from cthulhu.plugins.self_voice import plugin
|
|
|
|
|
|
class SelfVoicePluginRegressionTests(unittest.TestCase):
|
|
def test_socket_file_is_scoped_to_user_runtime_directory(self) -> None:
|
|
with mock.patch.dict(os.environ, {"XDG_RUNTIME_DIR": "/run/user/1000"}, clear=True):
|
|
self.assertEqual(plugin._get_socket_file(), "/run/user/1000/cthulhu.sock")
|
|
|
|
def test_socket_file_is_unavailable_without_user_runtime_directory(self) -> None:
|
|
with mock.patch.dict(os.environ, {}, clear=True):
|
|
self.assertIsNone(plugin._get_socket_file())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|