示例#1
0
class TestSequence(unittest.TestCase):
	""" Class to do all the testing"""
	
	def setUp(self):
		""" Things that will need to be run before the tests"""
		self._server_list = ServerList()
		self._server_list_matrix = self._server_list.make_matrix()

	def test_connect(self):
		self._ftp_connector = FTPConnector(self._server_list_matrix)

	def test_list(self):
		self._ftp_connector = FTPConnector(self._server_list_matrix)
		self._ftp_connector.list()

	def test_discconect(self):
		self._ftp_connector = FTPConnector(self._server_list_matrix)
		self._ftp_connector.disconnect()
	def test_CommentGenerate(self):
		c = CommentGenerate.CommentGenerate()
		c.openFile()
	def test_Database(self):
		d = Database.Database()
		file_list= [["fil1", "/etc/fil1", "server.se"],["fil2", "/etc/fil2", "server.org"],["fil3", "/etc/fil3", "server.com"]]
		d.updateDB(file_list)
		print "------DATABASE DUMP ---------"
		d.list()
		d.disconnect()
		#d.initDB() #This is already done and the file is in the repo 
		
	def test_Main(self):
		main = Main()
示例#2
0
文件: CLI.py 项目: sikevux/FTPCircle
class BasicCLI():
	"""Class for creating and handling the very basic CLI"""
	def __init__(self, server_list_name):
		self._server_list = ServerList(server_list_name)
		self._server_list_matrix = self._server_list.make_matrix()
		self._ftp_connector = FTPConnector(self._server_list_matrix)
		print("Welcome to FTPCircle!\nArguments: list, download, help, exit, serverlist")
		self.interface()

	def interface(self):
		self.luser_input = input("-> ")
		if self.luser_input == "list":
			self.interface_list()
		elif self.luser_input == "exit":
			sys.exit()
		elif self.luser_input.startswith("download "):
			self.interface_download()
		elif self.luser_input in ("help", "h", "?"):
			self.usage()
		elif self.luser_input.startswith("serverlist "):
			self.interface_serverlist()
		else:
			print("Your input was:", self.luser_input)
		self.interface()

	def interface_download(self):
		#TODO: Download interface to download
		download_list = self.luser_input.split(" ")
		print (download_list[1])
		#TODO: Download it

	def interface_serverlist(self):
		#TODO: Serverlist interface to pipe to download interface and list interface
		server_list_name = self.luser_input.split(" ")
		print(server_list_name[1])

	def interface_list(self):
		#TODO: List interface to list
		self._ftp_connector.list()

	def usage(self):
		"""Handler for CLI usage"""
		print("Arguments: list, download, help, exit\nlist: List folders on all servers\ndownload: Downloads file\nserverlist: Changes the list of servers to use\nhelp: Prints this message\nexit: Exits this program")
示例#3
0
	def test_discconect(self):
		self._ftp_connector = FTPConnector(self._server_list_matrix)
		self._ftp_connector.disconnect()
示例#4
0
	def test_connect(self):
		self._ftp_connector = FTPConnector(self._server_list_matrix)
示例#5
0
文件: CLI.py 项目: sikevux/FTPCircle
	def __init__(self, server_list_name):
		self._server_list = ServerList(server_list_name)
		self._server_list_matrix = self._server_list.make_matrix()
		self._ftp_connector = FTPConnector(self._server_list_matrix)
		print("Welcome to FTPCircle!\nArguments: list, download, help, exit, serverlist")
		self.interface()