@@ -1874,16 +1874,22 @@ def test_474_vm_device_list_attached_specific(self):
1874
1874
"mode='manual' frontend_domain='test-vm1' _attach_opt='value'\n " )
1875
1875
self .assertFalse (self .app .save .called )
1876
1876
1877
+ def get_dev (self , * args , ** kwargs ):
1878
+ yield DeviceInfo (Port (
1879
+ self .vm , '1234' , 'testclass' ),
1880
+ device_id = '0000:0000::t000000' ,)
1881
+
1877
1882
def test_480_vm_device_attach (self ):
1878
1883
self .vm .add_handler ('device-list:testclass' , self .device_list_testclass )
1884
+ self .vm .add_handler ('device-get:testclass' , self .get_dev )
1879
1885
mock_action = unittest .mock .Mock ()
1880
1886
mock_action .return_value = None
1881
1887
del mock_action ._is_coroutine
1882
1888
self .vm .add_handler (f'device-attach:testclass' , mock_action )
1883
1889
with unittest .mock .patch .object (qubes .vm .qubesvm .QubesVM ,
1884
1890
'is_halted' , lambda _ : False ):
1885
1891
value = self .call_mgmt_func (b'admin.vm.device.testclass.Attach' ,
1886
- b'test-vm1' , b'test-vm1+1234:0000:0000::?****** ' )
1892
+ b'test-vm1' , b'test-vm1+1234:0000:0000::t000000 ' )
1887
1893
self .assertIsNone (value )
1888
1894
mock_action .assert_called_once_with (
1889
1895
self .vm , f'device-attach:testclass' ,
@@ -1991,14 +1997,15 @@ def test_486_vm_device_assign_required_not_running(self):
1991
1997
1992
1998
def test_487_vm_device_attach_options (self ):
1993
1999
self .vm .add_handler ('device-list:testclass' , self .device_list_testclass )
2000
+ self .vm .add_handler ('device-get:testclass' , self .get_dev )
1994
2001
mock_attach = unittest .mock .Mock ()
1995
2002
mock_attach .return_value = None
1996
2003
del mock_attach ._is_coroutine
1997
2004
self .vm .add_handler ('device-attach:testclass' , mock_attach )
1998
2005
with unittest .mock .patch .object (qubes .vm .qubesvm .QubesVM ,
1999
2006
'is_halted' , lambda _ : False ):
2000
2007
value = self .call_mgmt_func (b'admin.vm.device.testclass.Attach' ,
2001
- b'test-vm1' , b'test-vm1+1234:0000:0000::?****** ' ,
2008
+ b'test-vm1' , b'test-vm1+1234:0000:0000::t000000 ' ,
2002
2009
b"_option1='value2'" )
2003
2010
self .assertIsNone (value )
2004
2011
dev = self .vm .devices ['testclass' ]['1234' ]
0 commit comments