tests/devices: make PEP8 happy
This commit is contained in:
parent
f633dd9b40
commit
07ca511bd7
@ -103,7 +103,8 @@ class TC_00_DeviceCollection(qubesadmin.tests.QubesTestCase):
|
|||||||
|
|
||||||
def test_020_attach(self):
|
def test_020_attach(self):
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.device.test.Attach', 'test-vm2+dev1', b'')] = \
|
('test-vm', 'admin.vm.device.test.Attach', 'test-vm2+dev1',
|
||||||
|
b'')] = \
|
||||||
b'0\0'
|
b'0\0'
|
||||||
assign = qubesadmin.devices.DeviceAssignment(
|
assign = qubesadmin.devices.DeviceAssignment(
|
||||||
self.app.domains['test-vm2'], 'dev1')
|
self.app.domains['test-vm2'], 'dev1')
|
||||||
@ -113,7 +114,7 @@ class TC_00_DeviceCollection(qubesadmin.tests.QubesTestCase):
|
|||||||
def test_021_attach_options(self):
|
def test_021_attach_options(self):
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.device.test.Attach', 'test-vm2+dev1',
|
('test-vm', 'admin.vm.device.test.Attach', 'test-vm2+dev1',
|
||||||
b'ro=True something=value')] = b'0\0'
|
b'ro=True something=value')] = b'0\0'
|
||||||
assign = qubesadmin.devices.DeviceAssignment(
|
assign = qubesadmin.devices.DeviceAssignment(
|
||||||
self.app.domains['test-vm2'], 'dev1')
|
self.app.domains['test-vm2'], 'dev1')
|
||||||
assign.options['ro'] = True
|
assign.options['ro'] = True
|
||||||
@ -124,7 +125,7 @@ class TC_00_DeviceCollection(qubesadmin.tests.QubesTestCase):
|
|||||||
def test_022_attach_persistent(self):
|
def test_022_attach_persistent(self):
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.device.test.Attach', 'test-vm2+dev1',
|
('test-vm', 'admin.vm.device.test.Attach', 'test-vm2+dev1',
|
||||||
b'persistent=True')] = b'0\0'
|
b'persistent=True')] = b'0\0'
|
||||||
assign = qubesadmin.devices.DeviceAssignment(
|
assign = qubesadmin.devices.DeviceAssignment(
|
||||||
self.app.domains['test-vm2'], 'dev1')
|
self.app.domains['test-vm2'], 'dev1')
|
||||||
assign.persistent = True
|
assign.persistent = True
|
||||||
@ -134,7 +135,7 @@ class TC_00_DeviceCollection(qubesadmin.tests.QubesTestCase):
|
|||||||
def test_023_attach_persistent_options(self):
|
def test_023_attach_persistent_options(self):
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.device.test.Attach', 'test-vm2+dev1',
|
('test-vm', 'admin.vm.device.test.Attach', 'test-vm2+dev1',
|
||||||
b'persistent=True ro=True')] = b'0\0'
|
b'persistent=True ro=True')] = b'0\0'
|
||||||
assign = qubesadmin.devices.DeviceAssignment(
|
assign = qubesadmin.devices.DeviceAssignment(
|
||||||
self.app.domains['test-vm2'], 'dev1')
|
self.app.domains['test-vm2'], 'dev1')
|
||||||
assign.persistent = True
|
assign.persistent = True
|
||||||
@ -145,7 +146,7 @@ class TC_00_DeviceCollection(qubesadmin.tests.QubesTestCase):
|
|||||||
def test_030_detach(self):
|
def test_030_detach(self):
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.device.test.Detach', 'test-vm2+dev1',
|
('test-vm', 'admin.vm.device.test.Detach', 'test-vm2+dev1',
|
||||||
None)] = b'0\0'
|
None)] = b'0\0'
|
||||||
assign = qubesadmin.devices.DeviceAssignment(
|
assign = qubesadmin.devices.DeviceAssignment(
|
||||||
self.app.domains['test-vm2'], 'dev1')
|
self.app.domains['test-vm2'], 'dev1')
|
||||||
self.vm.devices['test'].detach(assign)
|
self.vm.devices['test'].detach(assign)
|
||||||
@ -166,25 +167,25 @@ class TC_00_DeviceCollection(qubesadmin.tests.QubesTestCase):
|
|||||||
self.assertEqual(len(assigns), 2)
|
self.assertEqual(len(assigns), 2)
|
||||||
self.assertIsInstance(assigns[0], qubesadmin.devices.DeviceAssignment)
|
self.assertIsInstance(assigns[0], qubesadmin.devices.DeviceAssignment)
|
||||||
self.assertEqual(assigns[0].backend_domain,
|
self.assertEqual(assigns[0].backend_domain,
|
||||||
self.app.domains['test-vm2'])
|
self.app.domains['test-vm2'])
|
||||||
self.assertEqual(assigns[0].ident, 'dev1')
|
self.assertEqual(assigns[0].ident, 'dev1')
|
||||||
self.assertEqual(assigns[0].frontend_domain,
|
self.assertEqual(assigns[0].frontend_domain,
|
||||||
self.app.domains['test-vm'])
|
self.app.domains['test-vm'])
|
||||||
self.assertEqual(assigns[0].options, {})
|
self.assertEqual(assigns[0].options, {})
|
||||||
self.assertEqual(assigns[0].devclass, 'test')
|
self.assertEqual(assigns[0].devclass, 'test')
|
||||||
self.assertEqual(assigns[0].device,
|
self.assertEqual(assigns[0].device,
|
||||||
self.app.domains['test-vm2'].devices['test']['dev1'])
|
self.app.domains['test-vm2'].devices['test']['dev1'])
|
||||||
|
|
||||||
self.assertIsInstance(assigns[1], qubesadmin.devices.DeviceAssignment)
|
self.assertIsInstance(assigns[1], qubesadmin.devices.DeviceAssignment)
|
||||||
self.assertEqual(assigns[1].backend_domain,
|
self.assertEqual(assigns[1].backend_domain,
|
||||||
self.app.domains['test-vm3'])
|
self.app.domains['test-vm3'])
|
||||||
self.assertEqual(assigns[1].ident, 'dev2')
|
self.assertEqual(assigns[1].ident, 'dev2')
|
||||||
self.assertEqual(assigns[1].frontend_domain,
|
self.assertEqual(assigns[1].frontend_domain,
|
||||||
self.app.domains['test-vm'])
|
self.app.domains['test-vm'])
|
||||||
self.assertEqual(assigns[1].options, {})
|
self.assertEqual(assigns[1].options, {})
|
||||||
self.assertEqual(assigns[1].devclass, 'test')
|
self.assertEqual(assigns[1].devclass, 'test')
|
||||||
self.assertEqual(assigns[1].device,
|
self.assertEqual(assigns[1].device,
|
||||||
self.app.domains['test-vm3'].devices['test']['dev2'])
|
self.app.domains['test-vm3'].devices['test']['dev2'])
|
||||||
|
|
||||||
self.assertAllCalled()
|
self.assertAllCalled()
|
||||||
|
|
||||||
@ -197,20 +198,20 @@ class TC_00_DeviceCollection(qubesadmin.tests.QubesTestCase):
|
|||||||
self.assertEqual(len(assigns), 2)
|
self.assertEqual(len(assigns), 2)
|
||||||
self.assertIsInstance(assigns[0], qubesadmin.devices.DeviceAssignment)
|
self.assertIsInstance(assigns[0], qubesadmin.devices.DeviceAssignment)
|
||||||
self.assertEqual(assigns[0].backend_domain,
|
self.assertEqual(assigns[0].backend_domain,
|
||||||
self.app.domains['test-vm2'])
|
self.app.domains['test-vm2'])
|
||||||
self.assertEqual(assigns[0].ident, 'dev1')
|
self.assertEqual(assigns[0].ident, 'dev1')
|
||||||
self.assertEqual(assigns[0].frontend_domain,
|
self.assertEqual(assigns[0].frontend_domain,
|
||||||
self.app.domains['test-vm'])
|
self.app.domains['test-vm'])
|
||||||
self.assertEqual(assigns[0].options, {'ro': 'True'})
|
self.assertEqual(assigns[0].options, {'ro': 'True'})
|
||||||
self.assertEqual(assigns[0].persistent, False)
|
self.assertEqual(assigns[0].persistent, False)
|
||||||
self.assertEqual(assigns[0].devclass, 'test')
|
self.assertEqual(assigns[0].devclass, 'test')
|
||||||
|
|
||||||
self.assertIsInstance(assigns[1], qubesadmin.devices.DeviceAssignment)
|
self.assertIsInstance(assigns[1], qubesadmin.devices.DeviceAssignment)
|
||||||
self.assertEqual(assigns[1].backend_domain,
|
self.assertEqual(assigns[1].backend_domain,
|
||||||
self.app.domains['test-vm3'])
|
self.app.domains['test-vm3'])
|
||||||
self.assertEqual(assigns[1].ident, 'dev2')
|
self.assertEqual(assigns[1].ident, 'dev2')
|
||||||
self.assertEqual(assigns[1].frontend_domain,
|
self.assertEqual(assigns[1].frontend_domain,
|
||||||
self.app.domains['test-vm'])
|
self.app.domains['test-vm'])
|
||||||
self.assertEqual(assigns[1].options, {'ro': 'False'})
|
self.assertEqual(assigns[1].options, {'ro': 'False'})
|
||||||
self.assertEqual(assigns[1].persistent, True)
|
self.assertEqual(assigns[1].persistent, True)
|
||||||
self.assertEqual(assigns[1].devclass, 'test')
|
self.assertEqual(assigns[1].devclass, 'test')
|
||||||
@ -226,10 +227,10 @@ class TC_00_DeviceCollection(qubesadmin.tests.QubesTestCase):
|
|||||||
self.assertEqual(len(assigns), 1)
|
self.assertEqual(len(assigns), 1)
|
||||||
self.assertIsInstance(assigns[0], qubesadmin.devices.DeviceAssignment)
|
self.assertIsInstance(assigns[0], qubesadmin.devices.DeviceAssignment)
|
||||||
self.assertEqual(assigns[0].backend_domain,
|
self.assertEqual(assigns[0].backend_domain,
|
||||||
self.app.domains['test-vm3'])
|
self.app.domains['test-vm3'])
|
||||||
self.assertEqual(assigns[0].ident, 'dev2')
|
self.assertEqual(assigns[0].ident, 'dev2')
|
||||||
self.assertEqual(assigns[0].frontend_domain,
|
self.assertEqual(assigns[0].frontend_domain,
|
||||||
self.app.domains['test-vm'])
|
self.app.domains['test-vm'])
|
||||||
self.assertEqual(assigns[0].options, {})
|
self.assertEqual(assigns[0].options, {})
|
||||||
self.assertEqual(assigns[0].persistent, True)
|
self.assertEqual(assigns[0].persistent, True)
|
||||||
self.assertEqual(assigns[0].devclass, 'test')
|
self.assertEqual(assigns[0].devclass, 'test')
|
||||||
@ -244,10 +245,10 @@ class TC_00_DeviceCollection(qubesadmin.tests.QubesTestCase):
|
|||||||
self.assertEqual(len(assigns), 1)
|
self.assertEqual(len(assigns), 1)
|
||||||
self.assertIsInstance(assigns[0], qubesadmin.devices.DeviceAssignment)
|
self.assertIsInstance(assigns[0], qubesadmin.devices.DeviceAssignment)
|
||||||
self.assertEqual(assigns[0].backend_domain,
|
self.assertEqual(assigns[0].backend_domain,
|
||||||
self.app.domains['test-vm2'])
|
self.app.domains['test-vm2'])
|
||||||
self.assertEqual(assigns[0].ident, 'dev1')
|
self.assertEqual(assigns[0].ident, 'dev1')
|
||||||
self.assertEqual(assigns[0].frontend_domain,
|
self.assertEqual(assigns[0].frontend_domain,
|
||||||
self.app.domains['test-vm'])
|
self.app.domains['test-vm'])
|
||||||
self.assertEqual(assigns[0].options, {})
|
self.assertEqual(assigns[0].options, {})
|
||||||
self.assertEqual(assigns[0].persistent, False)
|
self.assertEqual(assigns[0].persistent, False)
|
||||||
self.assertAllCalled()
|
self.assertAllCalled()
|
||||||
@ -291,7 +292,7 @@ class TC_00_DeviceCollection(qubesadmin.tests.QubesTestCase):
|
|||||||
def test_070_update_persistent(self):
|
def test_070_update_persistent(self):
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.device.test.Set.persistent', 'test-vm2+dev1',
|
('test-vm', 'admin.vm.device.test.Set.persistent', 'test-vm2+dev1',
|
||||||
b'True')] = b'0\0'
|
b'True')] = b'0\0'
|
||||||
dev = qubesadmin.devices.DeviceInfo(
|
dev = qubesadmin.devices.DeviceInfo(
|
||||||
self.app.domains['test-vm2'], 'test', 'dev1')
|
self.app.domains['test-vm2'], 'test', 'dev1')
|
||||||
self.vm.devices['test'].update_persistent(dev, True)
|
self.vm.devices['test'].update_persistent(dev, True)
|
||||||
@ -300,7 +301,7 @@ class TC_00_DeviceCollection(qubesadmin.tests.QubesTestCase):
|
|||||||
def test_071_update_persistent_false(self):
|
def test_071_update_persistent_false(self):
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.device.test.Set.persistent', 'test-vm2+dev1',
|
('test-vm', 'admin.vm.device.test.Set.persistent', 'test-vm2+dev1',
|
||||||
b'False')] = b'0\0'
|
b'False')] = b'0\0'
|
||||||
dev = qubesadmin.devices.DeviceInfo(
|
dev = qubesadmin.devices.DeviceInfo(
|
||||||
self.app.domains['test-vm2'], 'test', 'dev1')
|
self.app.domains['test-vm2'], 'test', 'dev1')
|
||||||
self.vm.devices['test'].update_persistent(dev, False)
|
self.vm.devices['test'].update_persistent(dev, False)
|
||||||
|
Loading…
Reference in New Issue
Block a user