public void DefaultUrlsAreIgnored() { using (var folder = new TemporaryFolder("ServerSettingsModel")) { var original = HgRepository.CreateOrUseExisting(folder.Path, new NullProgress()); original.SetKnownRepositoryAddresses(new[] { new HttpRepositoryPath("default", "c://abc.com", false) }); var m = new ServerSettingsModel(); const string url = "unclickable://hg-private.languageforge.org/tpi"; m.InitFromProjectPath(folder.Path); m.SetUrlToUseIfSettingsAreEmpty(url); Assert.AreEqual(url, m.URL); } }
public void SetUrlToUseIfSettingsAreEmpty_RepoAlreadyExistsWithAServerAddress_IgnoresOfferedUrl() { using (var folder = new TemporaryFolder("ServerSettingsModel")) { var original = HgRepository.CreateOrUseExisting(folder.Path, new NullProgress()); var existing = "https://abc.com"; original.SetKnownRepositoryAddresses(new[] { new HttpRepositoryPath("languageforge.org [Safe Mode]", existing, false) }); var m = new ServerSettingsModel(); var url = "https://*****:*****@hg-public.languageforge.org/tpi"; m.InitFromProjectPath(folder.Path); m.SetUrlToUseIfSettingsAreEmpty(url); Assert.AreEqual(existing, m.URL); } }
public void DefaultUrlsAreIgnored() { using (var folder = new TemporaryFolder("ServerSettingsModel")) { var original = HgRepository.CreateOrUseExisting(folder.Path, new NullProgress()); var existing = "c://abc.com"; original.SetKnownRepositoryAddresses(new[] { new HttpRepositoryPath("default", existing, false) }); var m = new ServerSettingsModel(); var url = "c://*****:*****@hg-public.languagedepot.org/tpi"; m.InitFromProjectPath(folder.Path); m.SetUrlToUseIfSettingsAreEmpty(url); Assert.AreEqual(url, m.URL); } }
public void SaveSettings_NoHgFolderExists_CreatesOneWithCorrectPath() { using (var folder = new TemporaryFolder("ServerSettingsModel")) { var m = new ServerSettingsModel(); var url = "http://*****:*****@hg-public.languagedepot.org/tpi"; m.InitFromProjectPath(folder.Path); m.SetUrlToUseIfSettingsAreEmpty(url); m.SaveSettings(); Assert.IsTrue(Directory.Exists(folder.Combine(".hg"))); Assert.IsTrue(File.Exists(folder.Combine(".hg", "hgrc"))); var repo = HgRepository.CreateOrUseExisting(folder.Path, new NullProgress()); var address = repo.GetDefaultNetworkAddress <HttpRepositoryPath>(); Assert.AreEqual("languageDepot.org[safemode]".ToLower(), address.Name.ToLower()); Assert.AreEqual(url, address.URI); } }
public void SaveSettings_NoHgFolderExists_CreatesOneWithCorrectPath() { using (var folder = new TemporaryFolder("ServerSettingsModel")) { const string user = "******"; const string pass = "******"; const string host = "hg-public.languageforge.org/tpi"; const string url = "https://" + user + ":" + pass + "@" + host; var m = new ServerSettingsModel(); m.InitFromProjectPath(folder.Path); m.SetUrlToUseIfSettingsAreEmpty(url); m.SaveSettings(); Assert.That(folder.Combine(".hg"), Does.Exist); Assert.That(folder.Combine(".hg", "hgrc"), Does.Exist); var repo = HgRepository.CreateOrUseExisting(folder.Path, new NullProgress()); var address = repo.GetDefaultNetworkAddress <HttpRepositoryPath>(); Assert.AreEqual(new ServerSettingsModel.BandwidthItem(ServerSettingsModel.BandwidthEnum.High), m.Bandwidth); Assert.AreEqual("https://" + host, address.URI); Assert.AreEqual(user, m.Username); Assert.AreEqual(pass, m.Password); } }
public void SaveSettings_NoHgFolderExists_CreatesOneWithCorrectPath() { using (var folder = new TemporaryFolder("ServerSettingsModel")) { var m = new ServerSettingsModel(); var url = "http://*****:*****@hg-public.languagedepot.org/tpi"; m.InitFromProjectPath(folder.Path); m.SetUrlToUseIfSettingsAreEmpty(url); m.SaveSettings(); Assert.IsTrue(Directory.Exists(folder.Combine(".hg"))); Assert.IsTrue(File.Exists(folder.Combine(".hg","hgrc"))); var repo = HgRepository.CreateOrUseExisting(folder.Path, new NullProgress()); var address = repo.GetDefaultNetworkAddress<HttpRepositoryPath>(); Assert.AreEqual("languageDepot.org[safemode]".ToLower(), address.Name.ToLower()); Assert.AreEqual(url, address.URI); } }