Add Power-Profile module
This commit is contained in:
parent
9c5e30ac61
commit
85760926d7
5 changed files with 139 additions and 0 deletions
32
tests/modules/contrib/test_power-profile.py
Normal file
32
tests/modules/contrib/test_power-profile.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
from unittest.mock import patch, MagicMock
|
||||
import unittest
|
||||
import pytest
|
||||
|
||||
import core.config
|
||||
import modules.contrib.power_profile
|
||||
|
||||
pytest.importorskip("dbus")
|
||||
|
||||
|
||||
def build_powerprofile_module():
|
||||
config = core.config.Config([])
|
||||
return modules.contrib.power_profile.Module(config=config, theme=None)
|
||||
|
||||
|
||||
class TestPowerProfileUnit(unittest.TestCase):
|
||||
def __get_mock_dbus_get_method(self, mock_system_bus):
|
||||
return (
|
||||
mock_system_bus.return_value.get_object.return_value.get_dbus_method.return_value
|
||||
)
|
||||
|
||||
def test_load_module(self):
|
||||
__import__("modules.contrib.power-profile")
|
||||
|
||||
@patch("dbus.SystemBus")
|
||||
def test_full_text(self, mock_system_bus):
|
||||
mock_get = self.__get_mock_dbus_get_method(mock_system_bus)
|
||||
mock_get.return_value = "balanced"
|
||||
|
||||
module = build_powerprofile_module()
|
||||
module.update()
|
||||
assert module.widgets()[0].full_text() == "balanced"
|
Loading…
Add table
Add a link
Reference in a new issue