1 2from smb.SMBConnection import SMBConnection 3from .util import getConnectionInfo 4from nose.tools import with_setup 5from smb import smb_structs 6 7conn = None 8 9def setup_func_SMB1(): 10 global conn 11 smb_structs.SUPPORT_SMB2 = False 12 info = getConnectionInfo() 13 conn = SMBConnection(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True) 14 assert conn.connect(info['server_ip'], info['server_port']) 15 16def setup_func_SMB2(): 17 global conn 18 smb_structs.SUPPORT_SMB2 = True 19 info = getConnectionInfo() 20 conn = SMBConnection(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True) 21 assert conn.connect(info['server_ip'], info['server_port']) 22 23def teardown_func(): 24 global conn 25 conn.close() 26 27@with_setup(setup_func_SMB1, teardown_func) 28def test_listsnapshots_SMB1(): 29 global conn 30 results = conn.listSnapshots('smbtest', '/rfc1001.txt') 31 assert len(results) > 0 32 33@with_setup(setup_func_SMB2, teardown_func) 34def test_listsnapshots_SMB2(): 35 global conn 36 results = conn.listSnapshots('smbtest', '/rfc1001.txt') 37 assert len(results) > 0 38