tests: improve devices API unit test

Check fired events - inspired by qvm-device test.
This commit is contained in:
Marek Marczykowski-Górecki 2017-02-23 00:18:54 +01:00
parent 7f2ca33774
commit 3ecc0a9bcb
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -111,6 +111,7 @@ class TC_00_DeviceCollection(qubes.tests.QubesTestCase):
def test_013_list_attached_persistent(self):
self.assertEqual(set([]), set(self.collection.attached()))
self.assertEventFired(self.emitter, 'device-list-attached:testclass')
self.collection.attach(self.device)
self.assertEqual({self.device}, set(self.collection.attached()))
self.assertEqual({self.device},
@ -128,9 +129,11 @@ class TC_00_DeviceCollection(qubes.tests.QubesTestCase):
set(self.collection.attached(persistent=True)))
self.assertEqual({self.device},
set(self.collection.attached(persistent=False)))
self.assertEventFired(self.emitter, 'device-list-attached:testclass')
def test_015_list_available(self):
self.assertEqual({self.device}, set(self.collection))
self.assertEventFired(self.emitter, 'device-list:testclass')
class TC_01_DeviceManager(qubes.tests.QubesTestCase):