Exemplo n.º 1
0
def smb_share(request, smb_real):
    # Use some non ASCII chars to test out edge cases by default.
    share_path = u"%s\\%s" % (smb_real[request.param[1]], u"Pýtæs†-[%s] 💩" % time.time())
    delete_session(smb_real[2])

    # Test out forward slashes also work with the share-encrypted test
    if request.param[0] == 'share-encrypted':
        share_path = share_path.replace('\\', '/')

    mkdir(share_path, username=smb_real[0], password=smb_real[1], port=smb_real[3])
    try:
        yield share_path
    finally:
        rmtree(share_path, username=smb_real[0], password=smb_real[1], port=smb_real[3])
Exemplo n.º 2
0
def smb_dfs_share(request, smb_real):
    test_folder = u"Pýtæs†-[%s] 💩" % time.time()

    if request.param[1]:
        target_share_path = u"%s\\%s" % (smb_real[request.param[1]], test_folder)
        dfs_path = u'\\\\%s\\dfs\\%s\\%s' % (smb_real[2], request.param[0], test_folder)

    else:
        target_share_path = u"\\\\%s\\dfs\\%s" % (smb_real[2], test_folder)
        dfs_path = target_share_path

    mkdir(target_share_path, username=smb_real[0], password=smb_real[1], port=smb_real[3])
    try:
        yield dfs_path
    finally:
        rmtree(target_share_path, username=smb_real[0], password=smb_real[1], port=smb_real[3])

        config = ClientConfig()
        config._domain_cache = []
        config._referral_cache = []