当前位置: 首页>>代码示例>>Python>>正文


Python util.getConnectionInfo函数代码示例

本文整理汇总了Python中util.getConnectionInfo函数的典型用法代码示例。如果您正苦于以下问题:Python getConnectionInfo函数的具体用法?Python getConnectionInfo怎么用?Python getConnectionInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getConnectionInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_overwrite

def test_overwrite():
    info = util.getConnectionInfo()
    info['filename'] = os.sep + 'StoreTest-%d-%d.dat' % ( time.time(), random.randint(0, 10000) )

    test_s = 'test1234'
    test_md = MD5()
    test_md.update(test_s)

    director = urllib2.build_opener(SMBHandler)
    upload_fh = director.open('smb://%(user)s:%(password)[email protected]%(server_ip)s/smbtest/%(filename)s' % info, data = StringIO(test_s))

    retr_fh = director.open('smb://%(user)s:%(password)[email protected]%(server_ip)s/smbtest/%(filename)s' % info)

    s = retr_fh.read()
    md = MD5()
    md.update(s)

    assert md.hexdigest() == test_md.hexdigest()
    assert len(s) == len(test_s)

    upload_fh = director.open('smb://%(user)s:%(password)[email protected]%(server_ip)s/smbtest/%(filename)s' % info, data = open(TEST_FILENAME, 'rb'))

    retr_fh = director.open('smb://%(user)s:%(password)[email protected]%(server_ip)s/smbtest/%(filename)s' % info)

    s = retr_fh.read()
    md = MD5()
    md.update(s)
开发者ID:50onRed,项目名称:pysmb,代码行数:27,代码来源:test_SMBHandler.py

示例2: test_listshares_SMB2

def test_listshares_SMB2():
    info = getConnectionInfo()
    smb_structs.SUPPORT_SMB2 = True

    factory = ListSharesFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
开发者ID:50onRed,项目名称:pysmb,代码行数:7,代码来源:test_listshares.py

示例3: setup_func_SMB2

def setup_func_SMB2():
    global conn
    smb_structs.SUPPORT_SMB2 = True

    info = getConnectionInfo()
    conn = SMBConnection(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
    assert conn.connect(info['server_ip'], info['server_port'])
开发者ID:50onRed,项目名称:pysmb,代码行数:7,代码来源:test_storefile.py

示例4: test_store_long_filename_SMB1

def test_store_long_filename_SMB1():
    info = getConnectionInfo()
    smb_structs.SUPPORT_SMB2 = False

    factory = StoreFilesFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
    factory.service_name = 'smbtest'
    factory.filename = os.sep + 'StoreTest %d-%d.dat' % ( time.time(), random.randint(0, 10000) )
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
开发者ID:50onRed,项目名称:pysmb,代码行数:9,代码来源:test_storefile.py

示例5: test_unicode_directory_SMB2

def test_unicode_directory_SMB2():
    info = getConnectionInfo()
    smb_structs.SUPPORT_SMB2 = True

    factory = DirectoryFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
    factory.service_name = 'smbtest'
    factory.path = os.sep + u'文件夹创建 %d-%d' % ( time.time(), random.randint(0, 1000) )
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
开发者ID:50onRed,项目名称:pysmb,代码行数:9,代码来源:test_createdeletedirectory.py

示例6: test_listshares_SMB2

def test_listshares_SMB2():
    info = getConnectionInfo()
    smb_structs.SUPPORT_SMB2 = True

    factory = ListSnapshotsFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
    factory.service_name = 'smbtest'
    factory.path = '/rfc1001.txt'
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
开发者ID:50onRed,项目名称:pysmb,代码行数:9,代码来源:test_listsnapshots.py

示例7: test_rename_unicode_directory_SMB2

def test_rename_unicode_directory_SMB2():
    info = getConnectionInfo()
    smb_structs.SUPPORT_SMB2 = True

    factory = RenameDirectoryFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
    factory.service = 'smbtest'
    factory.old_path = u'/改名测试 %d-%d' % ( time.time(), random.randint(1000, 9999) )
    factory.new_path = u'/改名测试 %d-%d' % ( time.time(), random.randint(1000, 9999) )
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
开发者ID:50onRed,项目名称:pysmb,代码行数:10,代码来源:test_rename.py

示例8: test_rename_english_file_SMB2

def test_rename_english_file_SMB2():
    info = getConnectionInfo()
    smb_structs.SUPPORT_SMB2 = True

    factory = RenameFileFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
    factory.service = 'smbtest'
    factory.old_path = '/RenameTest %d-%d.txt' % ( time.time(), random.randint(1000, 9999) )
    factory.new_path = '/RenameTest %d-%d.txt' % ( time.time(), random.randint(1000, 9999) )
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
开发者ID:50onRed,项目名称:pysmb,代码行数:10,代码来源:test_rename.py

示例9: test_NTLMv2_auth_SMB2

def test_NTLMv2_auth_SMB2():
    def result(auth_passed):
        assert auth_passed

    smb_structs.SUPPORT_SMB2 = True
    info = getConnectionInfo()
    factory = AuthFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
    factory.d.addCallback(result)
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
开发者ID:50onRed,项目名称:pysmb,代码行数:10,代码来源:test_auth.py

示例10: test_retr_unicodefilename_SMB2

def test_retr_unicodefilename_SMB2():
    # Test file retrieval that has a long non-English filename inside a folder with a non-English name
    info = getConnectionInfo()
    smb_structs.SUPPORT_SMB2 = True

    factory = RetrieveFileFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
    factory.service = 'smbtest'
    factory.path = u'/测试文件夹/垃圾文件.dat'
    factory.digest = '8a44c1e80d55e91c92350955cdf83442'
    factory.filesize = 256000
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
开发者ID:50onRed,项目名称:pysmb,代码行数:12,代码来源:test_retrievefile.py

示例11: test_retr_multiplereads_SMB2

def test_retr_multiplereads_SMB2():
    # Test file retrieval using multiple ReadAndx calls (assuming each call will not reach more than 65534 bytes)
    info = getConnectionInfo()
    smb_structs.SUPPORT_SMB2 = True

    factory = RetrieveFileFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
    factory.service = 'smbtest'
    factory.path = '/rfc1001.txt'
    factory.digest = '5367c2bbf97f521059c78eab65309ad3'
    factory.filesize = 158437
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
开发者ID:50onRed,项目名称:pysmb,代码行数:12,代码来源:test_retrievefile.py

示例12: test_retr_longfilename_SMB1

def test_retr_longfilename_SMB1():
    # Test file retrieval that has a long English filename
    info = getConnectionInfo()
    smb_structs.SUPPORT_SMB2 = False

    factory = RetrieveFileFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
    factory.service = 'smbtest'
    factory.path = '/Implementing CIFS - SMB.html'
    factory.digest = '671c5700d279fcbbf958c1bba3c2639e'
    factory.filesize = 421269
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
开发者ID:50onRed,项目名称:pysmb,代码行数:12,代码来源:test_retrievefile.py

示例13: test_retr_offset_SMB2

def test_retr_offset_SMB2():
    # Test file retrieval from offset to EOF
    info = getConnectionInfo()
    smb_structs.SUPPORT_SMB2 = True

    factory = RetrieveFileFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
    factory.service = 'smbtest'
    factory.path = u'/测试文件夹/垃圾文件.dat'
    factory.digest = 'a141bd8024571ce7cb5c67f2b0d8ea0b'
    factory.filesize = 156000
    factory.offset = 100000
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
开发者ID:50onRed,项目名称:pysmb,代码行数:13,代码来源:test_retrievefile.py

示例14: test_retr_offset_and_biglimit_SMB2

def test_retr_offset_and_biglimit_SMB2():
    # Test file retrieval from offset with a big max_length
    info = getConnectionInfo()
    smb_structs.SUPPORT_SMB2 = True

    factory = RetrieveFileFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
    factory.service = 'smbtest'
    factory.path = u'/测试文件夹/垃圾文件.dat'
    factory.digest = '83b7afd7c92cdece3975338b5ca0b1c5'
    factory.filesize = 100000
    factory.offset = 100000
    factory.max_length = 100000
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
开发者ID:50onRed,项目名称:pysmb,代码行数:14,代码来源:test_retrievefile.py

示例15: test_retr_offset_and_smalllimit_SMB2

def test_retr_offset_and_smalllimit_SMB2():
    # Test file retrieval from offset with a small max_length
    info = getConnectionInfo()
    smb_structs.SUPPORT_SMB2 = True

    factory = RetrieveFileFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
    factory.service = 'smbtest'
    factory.path = u'/测试文件夹/垃圾文件.dat'
    factory.digest = '746f60a96b39b712a7b6e17ddde19986'
    factory.filesize = 10
    factory.offset = 100000
    factory.max_length = 10
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
开发者ID:50onRed,项目名称:pysmb,代码行数:14,代码来源:test_retrievefile.py


注:本文中的util.getConnectionInfo函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。