#NEWLINE# @ mock . patch ( 'cloudferry.lib.os.storage.plugins.iscsi.iscsi.local.sudo_ignoring_errors' ) #NEWLINE# def test_sessions_returns_correct_list_of_volume_params( self , sudo_mock ) : #NEWLINE# #INDENT# out = '\n        tcp: [1] 172.29.65.22:3260,1 iqn.1992-04.com.emc:500009730027c990\n        tcp: [2] 172.29.65.36:3260,1 iqn.1992-04.com.emc:500009730027c994\n        tcp: [3] 172.29.65.35:3260,1 iqn.1992-04.com.emc:500009730027c954\n        tcp: [4] 172.29.65.38:3260,1 iqn.1992-04.com.emc:500009730027c91c\n        tcp: [5] 172.29.65.39:3260,1 iqn.1992-04.com.emc:500009730027c95c\n        tcp: [6] 172.29.65.26:3260,1 iqn.1992-04.com.emc:500009730027c998\n        tcp: [7] 172.29.65.34:3260,1 iqn.1992-04.com.emc:500009730027c914\n        ' #NEWLINE# sudo_mock . return_value = ( 0 , out ) #NEWLINE# connector = iscsi . ISCSIConnector ( storage_backend_timeout = 0 ) #NEWLINE# sessions = connector . get_sessions ( ) #NEWLINE# self . assertIsInstance ( sessions , list ) #NEWLINE# self . assertEqual ( 7 , len ( sessions ) ) #NEWLINE# self . assertTrue ( all ( [ isinstance ( s , iscsi . VolumeParams ) for s in sessions ] ) )