Browse Source

qubes: fix/update event names

Fix few typos, then rename:
 - recreate-appmenus -> domain-restore: there may be more to do than
 only appmenus
Marek Marczykowski-Górecki 8 năm trước cách đây
mục cha
commit
06c315c94b
3 tập tin đã thay đổi với 7 bổ sung7 xóa
  1. 4 4
      qubes/devices.py
  2. 1 1
      qubes/tests/devices.py
  3. 2 2
      qubes/tests/init2.py

+ 4 - 4
qubes/devices.py

@@ -59,9 +59,9 @@ class DeviceCollection(object):
             raise KeyError(
                 'device {!r} of class {} already attached to {!r}'.format(
                     device, self._class, self._vm))
-        self._vm.fire_event_pre('device-pre-attach' + self._class, device)
+        self._vm.fire_event_pre('device-pre-attach:' + self._class, device)
         self._set.add(device)
-        self._vm.fire_event('device-attach' + self._class, device)
+        self._vm.fire_event('device-attach:' + self._class, device)
 
 
     def detach(self, device):
@@ -74,9 +74,9 @@ class DeviceCollection(object):
             raise KeyError(
                 'device {!r} of class {} not attached to {!r}'.format(
                     device, self._class, self._vm))
-        self._vm.fire_event_pre('device-pre-detach:{}' + self._class, device)
+        self._vm.fire_event_pre('device-pre-detach:' + self._class, device)
         self._set.remove(device)
-        self._vm.fire_event('device-detach' + self._class, device)
+        self._vm.fire_event('device-detach:' + self._class, device)
 
 
     def __iter__(self):

+ 1 - 1
qubes/tests/devices.py

@@ -78,5 +78,5 @@ class TC_01_DeviceManager(qubes.tests.QubesTestCase):
 
     def test_001_missing(self):
         self.manager['testclass'].attach('testdev')
-        self.assertEventFired(self.emitter, 'device-attached:testclass')
+        self.assertEventFired(self.emitter, 'device-attach:testclass')
 

+ 2 - 2
qubes/tests/init2.py

@@ -72,7 +72,7 @@ class TC_30_VMCollection(qubes.tests.QubesTestCase):
         self.vms.add(self.testvm1)
         self.assertIn(1, self.vms)
 
-        self.assertEventFired(self.app, 'domain-added', args=[self.testvm1])
+        self.assertEventFired(self.app, 'domain-add', args=[self.testvm1])
 
         with self.assertRaises(TypeError):
             self.vms.add(object())
@@ -125,7 +125,7 @@ class TC_30_VMCollection(qubes.tests.QubesTestCase):
         del self.vms['testvm2']
 
         self.assertItemsEqual(self.vms.vms(), [self.testvm1])
-        self.assertEventFired(self.app, 'domain-deleted', args=[self.testvm2])
+        self.assertEventFired(self.app, 'domain-delete', args=[self.testvm2])
 
     def test_100_get_new_unused_qid(self):
         self.vms.add(self.testvm1)