예제 #1
0
def test_version():
    toml_path = os.path.join(
        os.path.abspath(os.path.dirname(__file__)), "..", "pyproject.toml"
    )
    with open(toml_path, "r") as f:
        pyproject = toml.load(f)

    toml_version = pyproject["tool"]["poetry"]["version"]

    with mock.patch.object(sys.stdout, "write") as stdout_mock:
        main(["--version"])
        stdout_mock.assert_called_once_with(f"{toml_version}\n")
예제 #2
0
def test_set_power(value: int):
    with get_monitors_mock, mock.patch.object(
        Monitor, "set_power_mode"
    ) as api_mock:
        main(["--set-power", str(value)])
        api_mock.assert_called_once_with(value)
예제 #3
0
def test_get_power():
    with get_monitors_mock, mock.patch.object(
        Monitor, "get_power_mode"
    ) as api_mock:
        main(["--get-power"])
        api_mock.assert_called_once()
예제 #4
0
def test_get_luminance():
    with get_monitors_mock, mock.patch.object(
        Monitor, "get_luminance"
    ) as api_mock:
        main(["--get-luminance"])
        api_mock.assert_called_once()
예제 #5
0
def test_version():
    with mock.patch.object(sys.stdout, "write") as stdout_mock:
        main(["--version"])
        stdout_mock.assert_called_once()