Skip to content

Commit

Permalink
fix: update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gerblesh committed Sep 2, 2024
1 parent 5d6f062 commit 1afc097
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ublue_update/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ def get_active_sessions():
sessions = json.loads(out.stdout.decode("utf-8"))
active_sessions = []
for session in sessions:
if session.get("state") == "Active":
if session.get("state") == "active":
active_sessions.append(session)
return active_sessions
7 changes: 5 additions & 2 deletions tests/unit/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import sys
import os
from unittest.mock import patch, MagicMock, mock_open
from unittest.mock import patch, MagicMock

# Add the src directory to the sys.path
sys.path.insert(
Expand All @@ -22,7 +22,7 @@
@patch("ublue_update.cli.subprocess.run")
def test_notify_no_dbus_notify(mock_run, mock_log, mock_os, mock_cfg):
mock_cfg.dbus_notify = False
assert notify("test_title", "test_body") == None
assert notify("test_title", "test_body") is None


@patch("ublue_update.cli.cfg")
Expand Down Expand Up @@ -198,6 +198,7 @@ def test_run_updates_system(
)
mock_run.assert_any_call(
[
"TOPGRADE_SKIP_BRKC_NOTIFY=true",
"/usr/bin/topgrade",
"--config",
"/usr/share/ublue-update/topgrade-system.toml",
Expand Down Expand Up @@ -245,6 +246,7 @@ def test_run_updates_without_image_update(
mock_notify.assert_not_called()
mock_run.assert_any_call(
[
"TOPGRADE_SKIP_BRKC_NOTIFY=true",
"/usr/bin/topgrade",
"--config",
"/usr/share/ublue-update/topgrade-system.toml",
Expand Down Expand Up @@ -292,6 +294,7 @@ def test_run_updates_system_reboot(
)
mock_run.assert_any_call(
[
"TOPGRADE_SKIP_BRKC_NOTIFY=true",
"/usr/bin/topgrade",
"--config",
"/usr/share/ublue-update/topgrade-system.toml",
Expand Down

0 comments on commit 1afc097

Please sign in to comment.