Test for MKD / RMD works like a charm
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		| @@ -76,6 +76,7 @@ class Authetication: | ||||
|  | ||||
|         shutil.rmtree(self.HOME_DIRECTORY_LOCATION) | ||||
|         os.mkdir(self.HOME_DIRECTORY_LOCATION) | ||||
|         os.mkdir(self.HOME_DIRECTORY_LOCATION + os.path.sep + '0') | ||||
|         shutil.rmtree(self.PRIVATE_KEY_DIRECTORY_LOCATION) | ||||
|         os.mkdir(self.PRIVATE_KEY_DIRECTORY_LOCATION) | ||||
|  | ||||
|   | ||||
| @@ -2,17 +2,23 @@ | ||||
|  | ||||
| import os | ||||
| import re | ||||
| import sys | ||||
|  | ||||
|  | ||||
| class Executor: | ||||
|     """This class executes commands recieved by the server""" | ||||
|  | ||||
|     ABSOLUTE_PATH = os.path.abspath(os.path.dirname(sys.argv[0])) | ||||
|     BASE_PATH = ABSOLUTE_PATH + os.path.sep + 'home' + os.path.sep | ||||
|     DEFAULT_FOLDER = BASE_PATH + '0' | ||||
|  | ||||
|     def __init__(self, currentDiectory: str, baseDir: str = ""): | ||||
|         self.currentDirectory = currentDiectory | ||||
|         if baseDir == "": | ||||
|             self.baseDir = self.currentDirectory | ||||
|             self.baseDir = self.DEFAULT_FOLDER | ||||
|         else: | ||||
|             self.baseDir = baseDir | ||||
|             self.baseDir = self.BASE_PATH + baseDir + os.path.sep | ||||
|  | ||||
|  | ||||
|     def sanitizeDirectory(self, inDirectory: str) -> str: | ||||
|         return re.sub('[^a-zA-Z0-9]', '', inDirectory) | ||||
| @@ -22,13 +28,13 @@ class Executor: | ||||
|  | ||||
|     def createDirectory(self, dirName: str) -> str: | ||||
|         dirName = self.sanitizeDirectory(dirName) | ||||
|         actualDirName = os.path.join(self.currentDirectory, dirName) | ||||
|         actualDirName: str = os.path.join(self.baseDir,self.currentDirectory,dirName) | ||||
|         os.mkdir(actualDirName) | ||||
|         return actualDirName | ||||
|  | ||||
|     def removeDirectory(self, dirName: str) -> str: | ||||
|         dirName = self.sanitizeDirectory(dirName) | ||||
|         actualDirName = os.path.join(self.currentDirectory, dirName) | ||||
|         actualDirName: str = os.path.join(self.baseDir, self.currentDirectory, dirName) | ||||
|         if actualDirName: | ||||
|             os.rmdir(actualDirName) | ||||
|         return actualDirName | ||||
|   | ||||
| @@ -21,13 +21,13 @@ class Server: | ||||
|  | ||||
|     def login(self, homeDir: str) -> None: | ||||
|         self.isAuthenticated = True | ||||
|         self.executor.baseDir = Executor(homeDir) | ||||
|         self.executor = Executor("", homeDir) | ||||
|  | ||||
|     def logout(self) -> None: | ||||
|         self.networkInstance.logout() | ||||
|         self.isAuthenticated = False | ||||
|         self.availableServer = False | ||||
|         self.executor.baseDir = Executor("") | ||||
|         self.executor = Executor("") | ||||
|  | ||||
|     def parseCommand(self, command: str) -> None: | ||||
|         if command == "LINOK": | ||||
|   | ||||
		Reference in New Issue
	
	Block a user