#NEWLINE# @ mock . patch . object ( fakelibvirt . virConnect , 'secretDefineXML' ) #NEWLINE# def test_create_secret( self , mock_sec ) : #NEWLINE# #INDENT# 'creating secrets with various usage_type.' #NEWLINE# self . host . create_secret ( 'rbd' , 'rbdvol' ) #NEWLINE# self . host . create_secret ( 'ceph' , 'cephvol' ) #NEWLINE# self . host . create_secret ( 'iscsi' , 'iscsivol' ) #NEWLINE# self . host . create_secret ( 'volume' , 'vol' ) #NEWLINE# self . assertRaises ( exception . NovaException , self . host . create_secret , 'foo' , 'foovol' ) #NEWLINE# secret = mock . MagicMock ( ) #NEWLINE# mock_sec . return_value = self #NEWLINE# self . host . create_secret ( 'iscsi' , 'iscsivol' , password = 'foo' ) #NEWLINE# secret . setValue . assert_called_once_with ( 'foo' )