test_utils.py 331 B

123456789101112
  1. import unittest.mock
  2. import pytest
  3. import systemctl_mqtt._utils
  4. @pytest.mark.parametrize("hostname", ["test"])
  5. def test__get_hostname(hostname):
  6. with unittest.mock.patch("socket.gethostname", return_value=hostname):
  7. # pylint: disable=protected-access
  8. assert systemctl_mqtt._utils.get_hostname() == hostname