def test_interface(self): """Test the DBus interface object.""" interface = DBusInterfaceIdentifier(namespace=("a", "b", "c")) self.assert_namespace(interface, ("a", "b", "c")) self.assert_interface(interface, "a.b.c") interface = DBusInterfaceIdentifier(namespace=("a", "b", "c"), interface_version=1) self.assert_namespace(interface, ("a", "b", "c")) self.assert_interface(interface, "a.b.c1") interface = DBusInterfaceIdentifier(basename="d", namespace=("a", "b", "c"), interface_version=1) self.assert_namespace(interface, ("a", "b", "c", "d")) self.assert_interface(interface, "a.b.c.d1")
def test_get_proxy_for_interface(self): """Test getting a proxy for an interface.""" bus = Mock() namespace = ("a", "b", "c") service = DBusServiceIdentifier(namespace=namespace, message_bus=bus) interface = DBusInterfaceIdentifier(basename="interface", namespace=namespace) service.get_proxy(interface_name="a.b.c.interface") bus.get_proxy.assert_called_with("a.b.c", "/a/b/c", "a.b.c.interface") bus.reset_mock() service.get_proxy(interface_name=interface) bus.get_proxy.assert_called_with("a.b.c", "/a/b/c", "a.b.c.interface") bus.reset_mock()
# (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # from dasbus.identifier import DBusInterfaceIdentifier from pyanaconda.modules.common.constants.namespaces import ANACONDA_NAMESPACE, \ MODULES_NAMESPACE, USERS_NAMESPACE, PARTITIONING_NAMESPACE, DNF_NAMESPACE, \ DEVICE_TREE_NAMESPACE, PAYLOAD_BASE_NAMESPACE, PAYLOAD_SOURCE_NAMESPACE KICKSTART_MODULE = DBusInterfaceIdentifier(namespace=MODULES_NAMESPACE) USER = DBusInterfaceIdentifier(namespace=USERS_NAMESPACE, basename="User") PARTITIONING = DBusInterfaceIdentifier(namespace=PARTITIONING_NAMESPACE) TASK = DBusInterfaceIdentifier(namespace=ANACONDA_NAMESPACE, basename="Task") DEVICE_TREE_VIEWER = DBusInterfaceIdentifier(namespace=DEVICE_TREE_NAMESPACE, basename="Viewer") DEVICE_TREE_HANDLER = DBusInterfaceIdentifier(namespace=DEVICE_TREE_NAMESPACE, basename="Handler") DEVICE_TREE_RESIZABLE = DBusInterfaceIdentifier( namespace=DEVICE_TREE_NAMESPACE, basename="Resizable")
# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # from dasbus.identifier import DBusInterfaceIdentifier from pyanaconda.modules.common.constants.namespaces import ANACONDA_NAMESPACE, \ MODULES_NAMESPACE, PARTITIONING_NAMESPACE, DEVICE_TREE_NAMESPACE, PAYLOAD_NAMESPACE, \ SOURCE_NAMESPACE KICKSTART_MODULE = DBusInterfaceIdentifier( namespace=MODULES_NAMESPACE ) PARTITIONING = DBusInterfaceIdentifier( namespace=PARTITIONING_NAMESPACE ) TASK = DBusInterfaceIdentifier( namespace=ANACONDA_NAMESPACE, basename="Task" ) DEVICE_TREE_VIEWER = DBusInterfaceIdentifier( namespace=DEVICE_TREE_NAMESPACE, basename="Viewer" )
# # The common definitions # from dasbus.connection import SessionMessageBus from dasbus.identifier import DBusServiceIdentifier, DBusInterfaceIdentifier from dasbus.server.container import DBusContainer # Define the message bus. SESSION_BUS = SessionMessageBus() # Define namespaces. CHAT_NAMESPACE = ("org", "example", "Chat") ROOMS_NAMESPACE = (*CHAT_NAMESPACE, "Rooms") # Define services and objects. CHAT = DBusServiceIdentifier(namespace=CHAT_NAMESPACE, message_bus=SESSION_BUS) ROOM = DBusInterfaceIdentifier(namespace=CHAT_NAMESPACE, basename="Room") # Define containers. ROOM_CONTAINER = DBusContainer(namespace=ROOMS_NAMESPACE, message_bus=SESSION_BUS)