Skip to content

Commit

Permalink
Change: moved desktop_session to resource provider
Browse files Browse the repository at this point in the history
  • Loading branch information
p-gentili committed Nov 19, 2024
1 parent 54d55a5 commit cb15143
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 0 additions & 6 deletions providers/base/units/desktop/resource.pxu

This file was deleted.

File renamed without changes.
6 changes: 6 additions & 0 deletions providers/resource/jobs/resource.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -532,3 +532,9 @@ plugin: resource
_summary: Discover if the system supports power modes via acpi
_description: Discover resource info from /sys/firmware/apci
command: platform_profile_resource.py

id: desktop_session
plugin: resource
_summary: Check whether a desktop session is available and of which type.
environ: XDG_SESSION_TYPE XDG_CURRENT_DESKTOP
command: desktop_session_resource.py resources
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
"""This module provides test cases for the desktop_session module."""
"""This module provides test cases for the desktop_session_resource module."""

import os
import unittest
from unittest.mock import call, patch

import desktop_session
import desktop_session_resource


class DesktopSessionTests(unittest.TestCase):
"""Tests for the desktop_session module."""
"""Tests for the desktop_session_resource module."""

@patch("desktop_session.resources")
@patch("desktop_session_resource.resources")
def test_main(self, mock_resources):
"""
Test whether the main function calls the resources
function when requested via CLI.
"""
desktop_session.main(["resources"])
desktop_session_resource.main(["resources"])
mock_resources.assert_called_once_with()

@patch("builtins.print")
Expand All @@ -27,7 +27,7 @@ def test_resources_server(self, mock_print):
"XDG_SESSION_TYPE": "tty",
}
with patch.dict(os.environ, server_session, clear=True):
desktop_session.resources()
desktop_session_resource.resources()

mock_print.assert_has_calls(
[
Expand All @@ -45,7 +45,7 @@ def test_resources_desktop(self, mock_print):
"XDG_CURRENT_DESKTOP": "hyprland",
}
with patch.dict(os.environ, server_session, clear=True):
desktop_session.resources()
desktop_session_resource.resources()

mock_print.assert_has_calls(
[
Expand Down

0 comments on commit cb15143

Please sign in to comment.