Skip to content

Commit

Permalink
tests/registry: Test trying to re-register
Browse files Browse the repository at this point in the history
This is currently not allowed.
  • Loading branch information
jadahl committed Jan 26, 2025
1 parent f3951f8 commit 9a1df71
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,18 @@ def test_multiple_connections(self, portals, dbus_con):
app_id3 = mock_intf3.GetSessionAppId(session3.handle)
assert app_id3 == expected_app_id
dbus_con3.close()

def test_no_reregister(self, portals, dbus_con):
registry_intf = xdp.get_portal_iface(dbus_con, "Registry", domain="host")
mock_intf = xdp.get_mock_iface(dbus_con)

expected_app_id = "org.example.CorrectAppId"

registry_intf.Register(expected_app_id, {})
session = self.create_dummy_session(dbus_con)
app_id = mock_intf.GetSessionAppId(session.handle)
assert app_id == expected_app_id

with pytest.raises(dbus.exceptions.DBusException) as exc_info:
registry_intf.Register(expected_app_id, {})
exc_info.match(".*Connection already associated with an application ID.*")

0 comments on commit 9a1df71

Please sign in to comment.