2023-03-03 16:15:53 +01:00
|
|
|
#!/usr/bin/python2.7
|
2017-09-29 14:32:40 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#better run in an empty folder
|
|
|
|
|
|
|
|
import sys, os, subprocess, shutil, distutils, distutils.dir_util
|
|
|
|
from megacmd_tests_common import *
|
|
|
|
|
|
|
|
GET="mega-get"
|
|
|
|
PUT="mega-put"
|
|
|
|
RM="mega-rm"
|
|
|
|
CD="mega-cd"
|
|
|
|
LCD="mega-lcd"
|
|
|
|
MKDIR="mega-mkdir"
|
2018-01-08 14:18:03 +01:00
|
|
|
EXPORT="mega-export -f"
|
2017-09-29 14:32:40 +02:00
|
|
|
SHARE="mega-share"
|
|
|
|
FIND="mega-find"
|
|
|
|
WHOAMI="mega-whoami"
|
|
|
|
LOGOUT="mega-logout"
|
|
|
|
LOGIN="mega-login"
|
|
|
|
IPC="mega-ipc"
|
|
|
|
IMPORT="mega-import"
|
|
|
|
|
|
|
|
ABSPWD=os.getcwd()
|
|
|
|
currentTest=1
|
|
|
|
|
|
|
|
try:
|
|
|
|
MEGA_EMAIL=os.environ["MEGA_EMAIL"]
|
|
|
|
MEGA_PWD=os.environ["MEGA_PWD"]
|
|
|
|
MEGA_EMAIL_AUX=os.environ["MEGA_EMAIL_AUX"]
|
|
|
|
MEGA_PWD_AUX=os.environ["MEGA_PWD_AUX"]
|
|
|
|
except:
|
|
|
|
print >>sys.stderr, "You must define variables MEGA_EMAIL MEGA_PWD MEGA_EMAIL_AUX MEGA_PWD_AUX. WARNING: Use an empty account for $MEGA_EMAIL"
|
|
|
|
exit(1)
|
|
|
|
|
|
|
|
try:
|
|
|
|
os.environ['VERBOSE']
|
|
|
|
VERBOSE=True
|
|
|
|
except:
|
|
|
|
VERBOSE=False
|
|
|
|
|
|
|
|
#VERBOSE=True
|
|
|
|
|
|
|
|
try:
|
|
|
|
MEGACMDSHELL=os.environ['MEGACMDSHELL']
|
|
|
|
CMDSHELL=True
|
|
|
|
#~ FIND="executeinMEGASHELL find" #TODO
|
|
|
|
|
|
|
|
except:
|
|
|
|
CMDSHELL=False
|
|
|
|
|
|
|
|
def initialize_contents():
|
2017-10-05 12:26:28 +02:00
|
|
|
contents=" ".join(['"localtmp/'+x+'"' for x in os.listdir('localtmp/')])
|
|
|
|
cmd_ef(PUT+" "+contents+" /")
|
2017-09-29 14:32:40 +02:00
|
|
|
shutil.copytree('localtmp', 'localUPs')
|
|
|
|
|
|
|
|
def clean_all():
|
|
|
|
|
2017-10-05 12:26:28 +02:00
|
|
|
if cmd_es(WHOAMI) != osvar("MEGA_EMAIL"):
|
|
|
|
cmd_ef(LOGOUT)
|
|
|
|
cmd_ef(LOGIN+" " +osvar("MEGA_EMAIL")+" "+osvar("MEGA_PWD"))
|
2017-09-29 14:32:40 +02:00
|
|
|
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ec(RM+' -rf "*"')
|
|
|
|
cmd_ec(RM+' -rf "//bin/*"')
|
2017-09-29 14:32:40 +02:00
|
|
|
|
|
|
|
rmfolderifexisting("localUPs")
|
|
|
|
rmfolderifexisting("localtmp")
|
|
|
|
rmfolderifexisting("origin")
|
|
|
|
rmfolderifexisting("megaDls")
|
|
|
|
rmfolderifexisting("localDls")
|
|
|
|
|
|
|
|
rmfileifexisting("megafind.txt")
|
|
|
|
rmfileifexisting("localfind.txt")
|
|
|
|
|
|
|
|
def clear_dls():
|
|
|
|
rmcontentsifexisting("megaDls")
|
|
|
|
rmcontentsifexisting("localDls")
|
|
|
|
|
|
|
|
currentTest=1
|
|
|
|
|
|
|
|
def compare_and_clear():
|
|
|
|
global currentTest
|
|
|
|
|
|
|
|
megaDls=sort(find('megaDls'))
|
|
|
|
localDls=sort(find('localDls'))
|
|
|
|
|
|
|
|
#~ if diff megaDls localDls 2>/dev/null >/dev/null; then
|
|
|
|
if (megaDls == localDls):
|
|
|
|
print "test "+str(currentTest)+" succesful!"
|
|
|
|
if VERBOSE:
|
|
|
|
print "test "+str(currentTest)
|
|
|
|
print "megaDls:"
|
|
|
|
print megaDls
|
|
|
|
print
|
|
|
|
print "localDls:"
|
|
|
|
print localDls
|
|
|
|
print
|
|
|
|
else:
|
|
|
|
print "test "+str(currentTest)+" failed!"
|
|
|
|
|
|
|
|
print "megaDls:"
|
|
|
|
print megaDls
|
|
|
|
print
|
|
|
|
print "localDls:"
|
|
|
|
print localDls
|
|
|
|
print
|
|
|
|
exit(1)
|
|
|
|
|
|
|
|
clear_dls()
|
|
|
|
currentTest+=1
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(CD+" /")
|
2017-09-29 14:32:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
def check_failed_and_clear(o,status):
|
|
|
|
global currentTest
|
|
|
|
|
|
|
|
if status == 0:
|
|
|
|
print "test "+str(currentTest)+" failed!"
|
|
|
|
print o
|
|
|
|
exit(1)
|
|
|
|
else:
|
|
|
|
print "test "+str(currentTest)+" succesful!"
|
|
|
|
|
|
|
|
clear_dls()
|
|
|
|
currentTest+=1
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(CD+" /")
|
2017-09-29 14:32:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
def initialize_contents():
|
|
|
|
global URIFOREIGNEXPORTEDFOLDER
|
|
|
|
global URIFOREIGNEXPORTEDFILE
|
|
|
|
global URIEXPORTEDFOLDER
|
|
|
|
global URIEXPORTEDFILE
|
|
|
|
|
2017-10-05 12:26:28 +02:00
|
|
|
if cmd_es(WHOAMI) != osvar("MEGA_EMAIL_AUX"):
|
|
|
|
cmd_ef(LOGOUT)
|
|
|
|
cmd_ef(LOGIN+" " +osvar("MEGA_EMAIL_AUX")+" "+osvar("MEGA_PWD_AUX"))
|
2017-09-29 14:32:40 +02:00
|
|
|
|
|
|
|
if len(os.listdir(".")):
|
|
|
|
print >>sys.stderr, "initialization folder not empty!"
|
|
|
|
exit(1)
|
|
|
|
|
|
|
|
#initialize localtmp estructure:
|
|
|
|
makedir('foreign')
|
|
|
|
|
|
|
|
for f in ['cloud0'+a for a in ['1','2']] + \
|
|
|
|
['bin0'+a for a in ['1','2']] + \
|
|
|
|
['cloud0'+a+'/c0'+b+'s0'+c for a in ['1','2'] for b in ['1','2'] for c in ['1','2']] + \
|
|
|
|
['foreign'] + \
|
|
|
|
['foreign/sub0'+a for a in ['1','2']] + \
|
|
|
|
['bin0'+a+'/c0'+b+'s0'+c for a in ['1','2'] for b in ['1','2'] for c in ['1','2']]:
|
|
|
|
makedir(f)
|
|
|
|
out(f,f+'/fileat'+f.split('/')[-1]+'.txt')
|
|
|
|
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(PUT+' foreign /')
|
|
|
|
cmd_ef(SHARE+' foreign -a --with='+osvar("MEGA_EMAIL"))
|
|
|
|
URIFOREIGNEXPORTEDFOLDER=cmd_ef(EXPORT+' foreign/sub01 -a').split(' ')[-1]
|
|
|
|
URIFOREIGNEXPORTEDFILE=cmd_ef(EXPORT+' foreign/sub02/fileatsub02.txt -a').split(' ')[-1]
|
2017-09-29 14:32:40 +02:00
|
|
|
|
|
|
|
if VERBOSE:
|
|
|
|
print "URIFOREIGNEXPORTEDFOLDER=",URIFOREIGNEXPORTEDFILE
|
|
|
|
print "URIFOREIGNEXPORTEDFILE=",URIFOREIGNEXPORTEDFILE
|
|
|
|
|
|
|
|
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(LOGOUT)
|
|
|
|
cmd_ef(LOGIN+" " +osvar("MEGA_EMAIL")+" "+osvar("MEGA_PWD"))
|
|
|
|
cmd_ec(IPC+" -a "+osvar("MEGA_EMAIL_AUX"))
|
2017-09-29 14:32:40 +02:00
|
|
|
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(PUT+' foreign /')
|
2017-09-29 14:32:40 +02:00
|
|
|
|
|
|
|
#~ mega-put cloud0* /
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(PUT+" cloud01 cloud02 /")
|
2017-09-29 14:32:40 +02:00
|
|
|
|
|
|
|
#~ mega-put bin0* //bin
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(PUT+" bin01 bin02 //bin")
|
2017-09-29 14:32:40 +02:00
|
|
|
|
2017-10-05 12:26:28 +02:00
|
|
|
URIEXPORTEDFOLDER=cmd_ef(EXPORT+' cloud01/c01s01 -a').split(' ')[-1]
|
|
|
|
URIEXPORTEDFILE=cmd_ef(EXPORT+' cloud02/fileatcloud02.txt -a').split(' ')[-1]
|
2017-09-29 14:32:40 +02:00
|
|
|
|
|
|
|
if VERBOSE:
|
|
|
|
print "URIEXPORTEDFOLDER=",URIEXPORTEDFOLDER
|
|
|
|
print "URIEXPORTEDFILE=",URIEXPORTEDFILE
|
|
|
|
|
|
|
|
if VERBOSE: print "STARTING..."
|
|
|
|
|
|
|
|
#INITIALIZATION
|
|
|
|
clean_all
|
|
|
|
makedir('origin')
|
|
|
|
os.chdir('origin')
|
|
|
|
initialize_contents()
|
|
|
|
os.chdir(ABSPWD)
|
|
|
|
|
|
|
|
makedir('megaDls')
|
|
|
|
makedir('localDls')
|
|
|
|
|
|
|
|
ABSMEGADLFOLDER=ABSPWD+'/megaDls'
|
|
|
|
|
2017-10-05 12:26:28 +02:00
|
|
|
URIEXPORTEDFOLDER=cmd_ef(EXPORT+' cloud01/c01s01 -a').split(' ')[-1]
|
|
|
|
URIEXPORTEDFILE=cmd_ef(EXPORT+' cloud02/fileatcloud02.txt -a').split(' ')[-1]
|
2017-09-29 14:32:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
clear_dls()
|
|
|
|
|
|
|
|
#Test 01
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' /cloud01/fileatcloud01.txt '+ABSMEGADLFOLDER+'/')
|
2017-09-29 14:32:40 +02:00
|
|
|
shutil.copy2('origin/cloud01/fileatcloud01.txt','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 02
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' //bin/bin01/fileatbin01.txt '+ABSMEGADLFOLDER)
|
2017-09-29 14:32:40 +02:00
|
|
|
shutil.copy2('origin/bin01/fileatbin01.txt','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 03
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' //bin/bin01/fileatbin01.txt '+ABSMEGADLFOLDER+'/')
|
2017-09-29 14:32:40 +02:00
|
|
|
shutil.copy2('origin/bin01/fileatbin01.txt','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 04
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' '+osvar('MEGA_EMAIL_AUX')+':foreign/fileatforeign.txt '+ABSMEGADLFOLDER+'/')
|
2017-09-29 14:32:40 +02:00
|
|
|
shutil.copy2('origin/foreign/fileatforeign.txt','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 05
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' '+osvar('MEGA_EMAIL_AUX')+':foreign/fileatforeign.txt '+ABSMEGADLFOLDER+'/')
|
2017-09-29 14:32:40 +02:00
|
|
|
shutil.copy2('origin/foreign/fileatforeign.txt','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#~ #Test 06
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(CD+' cloud01')
|
|
|
|
cmd_ef(GET+' "*.txt" '+ABSMEGADLFOLDER+'')
|
2017-09-29 14:32:40 +02:00
|
|
|
copybyfilepattern('origin/cloud01/','*.txt','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 07
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(CD+' //bin/bin01')
|
|
|
|
cmd_ef(GET+' "*.txt" '+ABSMEGADLFOLDER+'')
|
2017-09-29 14:32:40 +02:00
|
|
|
copybyfilepattern('origin/bin01/','*.txt','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 08
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(CD+' '+osvar('MEGA_EMAIL_AUX')+':foreign')
|
|
|
|
cmd_ef(GET+' "*.txt" '+ABSMEGADLFOLDER+'')
|
2017-09-29 14:32:40 +02:00
|
|
|
copybyfilepattern('origin/foreign/','*.txt','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 09
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' cloud01/c01s01 '+ABSMEGADLFOLDER+'')
|
2017-09-29 14:32:40 +02:00
|
|
|
copyfolder('origin/cloud01/c01s01','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 10
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' cloud01/c01s01 '+ABSMEGADLFOLDER+'/')
|
2017-09-29 14:32:40 +02:00
|
|
|
copyfolder('origin/cloud01/c01s01','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#~ #Test 11
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' cloud01/c01s01 '+ABSMEGADLFOLDER+' -m')
|
2017-09-29 14:32:40 +02:00
|
|
|
distutils.dir_util.copy_tree('origin/cloud01/c01s01/', 'localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 12
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' cloud01/c01s01 '+ABSMEGADLFOLDER+'/ -m')
|
2017-09-29 14:32:40 +02:00
|
|
|
distutils.dir_util.copy_tree('origin/cloud01/c01s01/', 'localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 13
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' "'+URIEXPORTEDFOLDER+'" '+ABSMEGADLFOLDER+'')
|
2017-09-29 14:32:40 +02:00
|
|
|
copyfolder('origin/cloud01/c01s01','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 14
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' "'+URIEXPORTEDFILE+'" '+ABSMEGADLFOLDER+'')
|
2017-09-29 14:32:40 +02:00
|
|
|
shutil.copy2('origin/cloud02/fileatcloud02.txt','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 15
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' "'+URIEXPORTEDFOLDER+'" '+ABSMEGADLFOLDER+' -m')
|
2017-09-29 14:32:40 +02:00
|
|
|
distutils.dir_util.copy_tree('origin/cloud01/c01s01/', 'localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 16
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(CD+' /cloud01/c01s01')
|
|
|
|
cmd_ef(GET+' . '+ABSMEGADLFOLDER+'')
|
2017-09-29 14:32:40 +02:00
|
|
|
copyfolder('origin/cloud01/c01s01','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 17
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(CD+' /cloud01/c01s01')
|
|
|
|
cmd_ef(GET+' . '+ABSMEGADLFOLDER+' -m')
|
2017-09-29 14:32:40 +02:00
|
|
|
distutils.dir_util.copy_tree('origin/cloud01/c01s01/', 'localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 18
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(CD+' /cloud01/c01s01')
|
|
|
|
cmd_ef(GET+' ./ '+ABSMEGADLFOLDER+'')
|
2017-09-29 14:32:40 +02:00
|
|
|
copyfolder('origin/cloud01/c01s01','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 19
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(CD+' /cloud01/c01s01')
|
|
|
|
cmd_ef(GET+' ./ '+ABSMEGADLFOLDER+' -m')
|
2017-09-29 14:32:40 +02:00
|
|
|
distutils.dir_util.copy_tree('origin/cloud01/c01s01/', 'localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 20
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(CD+' /cloud01/c01s01')
|
|
|
|
cmd_ef(GET+' .. '+ABSMEGADLFOLDER+' -m')
|
2017-09-29 14:32:40 +02:00
|
|
|
distutils.dir_util.copy_tree('origin/cloud01/', 'localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 21
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(CD+' /cloud01/c01s01')
|
|
|
|
cmd_ef(GET+' ../ '+ABSMEGADLFOLDER+'')
|
2017-09-29 14:32:40 +02:00
|
|
|
copyfolder('origin/cloud01','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 22
|
|
|
|
out("existing",ABSMEGADLFOLDER+'/existing')
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' /cloud01/fileatcloud01.txt '+ABSMEGADLFOLDER+'/existing')
|
2017-09-29 14:32:40 +02:00
|
|
|
shutil.copy2('origin/cloud01/fileatcloud01.txt','localDls/existing (1)')
|
|
|
|
out("existing",'localDls/existing')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 23
|
|
|
|
out("existing",'megaDls/existing')
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' /cloud01/fileatcloud01.txt megaDls/existing')
|
2017-09-29 14:32:40 +02:00
|
|
|
shutil.copy2('origin/cloud01/fileatcloud01.txt','localDls/existing (1)')
|
|
|
|
out("existing",'localDls/existing')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 24
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' cloud01/c01s01 megaDls')
|
2017-09-29 14:32:40 +02:00
|
|
|
copyfolder('origin/cloud01/c01s01','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
currentTest=25
|
|
|
|
|
|
|
|
#Test 25
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' cloud01/fileatcloud01.txt megaDls')
|
2017-09-29 14:32:40 +02:00
|
|
|
shutil.copy2('origin/cloud01/fileatcloud01.txt','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
if not CMDSHELL: #TODO: currently there is no way to know last CMSHELL status code
|
|
|
|
#Test 26
|
2017-10-05 12:26:28 +02:00
|
|
|
o,status=cmd_ec(GET+' cloud01/fileatcloud01.txt /no/where')
|
2017-09-29 14:32:40 +02:00
|
|
|
check_failed_and_clear(o,status)
|
|
|
|
|
|
|
|
#Test 27
|
2017-10-05 12:26:28 +02:00
|
|
|
o,status=cmd_ec(GET+' /cloud01/cloud01/fileatcloud01.txt /no/where')
|
2017-09-29 14:32:40 +02:00
|
|
|
check_failed_and_clear(o,status)
|
|
|
|
|
|
|
|
currentTest=28
|
|
|
|
|
|
|
|
#Test 28
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' /cloud01/fileatcloud01.txt '+ABSMEGADLFOLDER+'/newfile')
|
2017-09-29 14:32:40 +02:00
|
|
|
shutil.copy2('origin/cloud01/fileatcloud01.txt','localDls/newfile')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 29
|
|
|
|
os.chdir(ABSMEGADLFOLDER)
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' /cloud01/fileatcloud01.txt .')
|
2017-09-29 14:32:40 +02:00
|
|
|
os.chdir(ABSPWD)
|
|
|
|
shutil.copy2('origin/cloud01/fileatcloud01.txt','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 30
|
|
|
|
os.chdir(ABSMEGADLFOLDER)
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' /cloud01/fileatcloud01.txt ./')
|
2017-09-29 14:32:40 +02:00
|
|
|
os.chdir(ABSPWD)
|
|
|
|
shutil.copy2('origin/cloud01/fileatcloud01.txt','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 31
|
|
|
|
makedir(ABSMEGADLFOLDER+'/newfol')
|
|
|
|
os.chdir(ABSMEGADLFOLDER+'/newfol')
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' /cloud01/fileatcloud01.txt ..')
|
2017-09-29 14:32:40 +02:00
|
|
|
os.chdir(ABSPWD)
|
|
|
|
makedir('localDls/newfol')
|
|
|
|
shutil.copy2('origin/cloud01/fileatcloud01.txt','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 32
|
|
|
|
makedir(ABSMEGADLFOLDER+'/newfol')
|
|
|
|
os.chdir(ABSMEGADLFOLDER+'/newfol')
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' /cloud01/fileatcloud01.txt ../')
|
2017-09-29 14:32:40 +02:00
|
|
|
os.chdir(ABSPWD)
|
|
|
|
makedir('localDls/newfol')
|
|
|
|
shutil.copy2('origin/cloud01/fileatcloud01.txt','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
if not CMDSHELL: #TODO: currently there is no way to know last CMSHELL status code
|
|
|
|
#Test 33
|
2017-10-05 12:26:28 +02:00
|
|
|
o,status=cmd_ec(GET+' path/to/nowhere '+ABSMEGADLFOLDER+' > /dev/null')
|
2017-09-29 14:32:40 +02:00
|
|
|
check_failed_and_clear(o,status)
|
|
|
|
|
|
|
|
#Test 34
|
2017-10-05 12:26:28 +02:00
|
|
|
o,status=cmd_ec(GET+' /path/to/nowhere '+ABSMEGADLFOLDER+' > /dev/null')
|
2017-09-29 14:32:40 +02:00
|
|
|
check_failed_and_clear(o,status)
|
|
|
|
|
|
|
|
currentTest=35
|
|
|
|
|
|
|
|
#Test 35
|
|
|
|
os.chdir(ABSMEGADLFOLDER)
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ef(GET+' /cloud01/fileatcloud01.txt')
|
2017-09-29 14:32:40 +02:00
|
|
|
os.chdir(ABSPWD)
|
|
|
|
shutil.copy2('origin/cloud01/fileatcloud01.txt','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
currentTest=36
|
|
|
|
|
|
|
|
#Test 36 # imported stuff (to test import folder)
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ex(RM+' -rf /imported')
|
|
|
|
cmd_ef(MKDIR+' -p /imported')
|
|
|
|
cmd_ef(IMPORT+' '+URIFOREIGNEXPORTEDFOLDER+' /imported')
|
|
|
|
cmd_ef(GET+' /imported/* '+ABSMEGADLFOLDER+'')
|
2017-09-29 14:32:40 +02:00
|
|
|
copyfolder('origin/foreign/sub01','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
#Test 37 # imported stuff (to test import file)
|
2017-10-05 12:26:28 +02:00
|
|
|
cmd_ex(RM+' -rf /imported')
|
|
|
|
cmd_ef(MKDIR+' -p /imported')
|
|
|
|
cmd_ef(IMPORT+' '+URIFOREIGNEXPORTEDFILE+' /imported')
|
|
|
|
cmd_ef(GET+' /imported/fileatsub02.txt '+ABSMEGADLFOLDER+'')
|
2017-09-29 14:32:40 +02:00
|
|
|
shutil.copy2('origin/foreign/sub02/fileatsub02.txt','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
2019-09-11 14:33:34 +02:00
|
|
|
|
|
|
|
#Test 38 # get from //from/XXX
|
|
|
|
cmd_ex(GET+' //from/'+osvar('MEGA_EMAIL_AUX')+':foreign/sub02/fileatsub02.txt '+ABSMEGADLFOLDER+'')
|
|
|
|
shutil.copy2('origin/foreign/sub02/fileatsub02.txt','localDls/')
|
|
|
|
compare_and_clear()
|
|
|
|
|
|
|
|
|
2017-09-29 14:32:40 +02:00
|
|
|
# Clean all
|
|
|
|
clean_all()
|