public void List() { var util = new FtpUtilities(); util.List("ftp://nic.funet.fi");//открытый ftp //с чем сравнивать? }
public void UploadNotExists() { string uploadFileName = "solution-upload"; string uploadUrl = "ftp://localhost/unit-tests/solutionTests/upload"; var exeName = uploadFileName + "-not-exist"; var config = Configuration.Load(FileSystem, uploadUrl, ""); var folder = string.Format("{0}/{1}/{2}", config.Site, FtpUtilities.GetLocalIP4(), exeName); var fileName = string.Format("{0}.txt", uploadFileName); var fullFileName = string.Format("{0}/{1}", folder, fileName); if (FileSystem.Exists(FileSystem.Combine(folder, fileName))) { FileSystem.DeleteFile(fullFileName); FileSystem.DeleteFolder(folder); } var unit = new Solution { LocalSourcePath = uploadFileName + ".txt", Task = new Task { ExecutableName = exeName, }, Configuration = config, }; unit.Upload(); Assert.IsTrue(FileSystem.Exists(FileSystem.Combine(folder, fileName))); }
public void Combine2() { var util = new FtpUtilities(); String path = "ftp://folder/"; String file = "file"; Assert.AreEqual("ftp://folder/file", util.Combine(path, file)); }
public void Download_ftp() { var util = new FtpUtilities(); FileStream FS = File.Create("README.txt"); util.Download("ftp://www.nic.funet.fi/pub/unix/OpenBSD/README", FS); FS.Close(); }//http://www.nic.funet.fi/pub/unix/OpenBSD/README
public void GetInfoPath() { var site = ""; var expected = string.Format("{1}\\info.json", site, FtpUtilities.GetLocalIP4()); var unit = Configuration.Load(new LocalFileSystem(), site, ""); Assert.AreEqual(expected, unit.InfoPath); }
public void Exists_With_Slash() { FileSystem.CreateFolder("folder"); FileStream ST = File.Create("SolutionTests.txt"); ST.Close(); var util = new FtpUtilities(); util.Exists("ftp://www.nic.funet.fi/pub/unix/OpenBSD/"); //Authority }
public void CreateVirtualDirectory() { string name = Guid.NewGuid().ToString("N"); string testDir = Path.Combine(Path.GetTempPath(), name); Directory.CreateDirectory(testDir); string username = Uhuru.Utilities.Credentials.GenerateCredential(5); string groupname = Uhuru.Utilities.Credentials.GenerateCredential(5); string password = "******"; string decoratedUsername = Uhuru.Utilities.WindowsVCAPUsers.CreateDecoratedUser(username, password); WindowsUsersAndGroups.CreateGroup(groupname, "Delete me. Uhuru test."); int port = Uhuru.Utilities.NetworkInterface.GrabEphemeralPort(); FtpUtilities.CreateFtpSite(name, testDir, port); Assert.IsFalse(FtpUtilities.HasUserAccess(name, decoratedUsername)); Assert.IsFalse(FtpUtilities.HasGroupAccess(name, groupname)); FtpUtilities.AddUserAccess(name, decoratedUsername); FtpUtilities.AddGroupAccess(name, groupname); Assert.IsTrue(FtpUtilities.HasUserAccess(name, decoratedUsername)); Assert.IsTrue(FtpUtilities.HasGroupAccess(name, groupname)); FtpUtilities.DeleteUserAccess(name, decoratedUsername); FtpUtilities.DeleteGroupAccess(name, groupname); Assert.IsTrue(FtpUtilities.Exists(name)); Assert.IsTrue(FtpUtilities.GetFtpSties().Contains(name)); Assert.IsFalse(FtpUtilities.HasUserAccess(name, decoratedUsername)); Assert.IsFalse(FtpUtilities.HasGroupAccess(name, groupname)); FtpUtilities.DeleteFtpSite(name); Assert.IsFalse(FtpUtilities.Exists(name)); Assert.IsFalse(FtpUtilities.GetFtpSties().Contains(name)); WindowsUsersAndGroups.DeleteGroup(groupname); Uhuru.Utilities.WindowsVCAPUsers.DeleteDecoratedBasedUser(username); }
public void Exists_Current_Dir() { var util = new FtpUtilities(); util.Exists("/"); }
public void GetFolferName_backslash() { var util = new FtpUtilities(); Assert.AreEqual("ftp://foldername", util.GetFolderName("ftp://foldername\\filename")); }
public void GetFolferName_with_ftp() { var util = new FtpUtilities(); Assert.AreEqual("ftp://foldername", util.GetFolderName("ftp://foldername/filename")); }
public void GetFileName2() { var util = new FtpUtilities(); Assert.AreEqual("filename", util.GetFileName("folder/filename")); }
public void GetFileName_Null() { var util = new FtpUtilities(); Assert.AreEqual(null, util.GetFileName(null)); }
public void GetFileName_Empty() { var util = new FtpUtilities(); Assert.AreEqual("", util.GetFileName("")); }
public void GetFileName() { var util = new FtpUtilities(); Assert.AreEqual("file.txt", util.GetFileName("file.txt")); }
public void Combine_ftp() { var util = new FtpUtilities(); Assert.AreEqual("ftp://www.nic.funet.fi/pub/unix/openbsd/readme", util.Combine("ftp://www.nic.funet.fi/pub/unix/OpenBSD", "README")); }
public void GetIP() { var addr = FtpUtilities.GetLocalIP4(); Assert.AreEqual(AddressFamily.InterNetwork, addr.AddressFamily); }