def test_copy_address_address(self): #주소 복사 검사 global Address address = unicode(Address) test_copy = extract_address().copy_address( address ) correctString = unicode(AddressDirectory+AddressCorrectName) self.assertEqual(test_copy,correctString)
def test_main_01(self): #given test_link2 = open ( os.path.dirname(__file__) +"\\test_null_address.txt",'r' ) #print test_link2 testArray = extract_address().main( test_link2 ) #print testArray trueArray = [ "C:\Users\Hojin\Desktop\exp02","C:\Users\Hojin\Desktop\exp1", unicode_conversion("C:\Users\Hojin\Desktop\ 새 폴더"),"C:\Users\Hojin\Desktop\\remove_expire.pyc", "D:\Fakefiles.txt" ] #print trueArray self.assertEqual( testArray, trueArray )
def test_null_address(self): #주소가 None 이나 빈공간 그리고 엔터키가 눌려진 공간과 섞여있을경우 주소를 가져오는지 검사 test_link2 = open (directoryName +"\\test_null_address.txt",'r') testArray = extract_address().get_address( test_link2 ) trueArray = [unicode_conversion("C:\Users\Hojin\Desktop\exp02"),unicode_conversion("C:\Users\Hojin\Desktop\exp1"), unicode_conversion("C:\Users\Hojin\Desktop\ 새 폴더"),unicode_conversion("C:\Users\Hojin\Desktop\\remove_expire.pyc"), unicode_conversion("D:\Fakefiles.txt") ] self.assertEqual( testArray, trueArray )
def test_get_address(self): #주소를 가져오는지 검사 global textFile TextFile = unicodes(textFile) global trueArray test_link = open (TextFile, 'r') # print TextFile # print test_link.readline() testArray = extract_address().get_address( test_link ) #trueArray = [ "C:\Users\Hojin\Desktop\exp02","C:\Users\Hojin\Desktop\exp1", # "C:\Users\Hojin\Desktop\ 새 폴더","C:\Users\Hojin\Desktop\\remove_expire.pyc", "D:\Fakefiles.txt" ] self.assertEqual(testArray,trueArray)
def test_copy_address_line_space(self): # 엔터 키가 눌려진 경우 복사가 되는 지 검사 test_copy = extract_address().copy_address( '\n' ) correctString ='' self.assertEqual(test_copy,correctString)
def test_copy_address_is_space(self): # 빈 공간이 있을시 복사가 되는지 검사 test_copy = extract_address().copy_address( ' ' ) correctString ='' self.assertEqual(test_copy,correctString)
def test_copy_address_isNone(self): #None 일경우 복사 가 되는지 검사 test_copy = extract_address().copy_address( None ) correctString ='' self.assertEqual(test_copy,correctString)
try: #need to make the directory before make the text. #global reportPath folderName = folderNameDate if not os.path.exists(folderName): os.makedirs (folderName) else: folderName = folderNameTime flag = 1 os.makedirs (folderName) reportPath = folderName +"\\"+reportName text = text_log() ##text.send_email(email,password,addresses) text.make_report(reportPath) text.initial(reportPath) function_address = extract_address() address = function_address.main(open(directoryPath)) ''' Copy the given directory ''' counter = 0 while counter < len(address) and address[counter] is not None: copy_folder(address[counter], reportPath, drive,flag) newAddress = copy_folder(address[counter], reportPath, drive,flag).get_directory_address(address[counter],drive,flag) ### do it here.===================================== '''address[counter] : the originalDirectory address newDirectory = : get directory address from the copy folder (path, drive parameters are required) :address[counter],drive) securityL1 = security_byte()