public void TestGetPlinkCompatibleUrl_Invalid() { // Test urls that are no valid uris, these should be ignored string inUrl, outUrl; inUrl = "foo://server/path/to/project.git"; outUrl = Plink.GetPlinkCompatibleUrl(inUrl); Assert.AreEqual("\"" + inUrl + "\"", outUrl); inUrl = @"ssh:\\server\path\to\project.git"; outUrl = Plink.GetPlinkCompatibleUrl(inUrl); Assert.AreEqual("\"" + inUrl + "\"", outUrl); }
public void TestGetPlinkCompatibleUrl_Compatible() { // Test urls that are already compatible, these shouldn't be changed string inUrl, outUrl; // ssh in compatible form inUrl = "[email protected]:gitextensions/gitextensions.git"; outUrl = Plink.GetPlinkCompatibleUrl(inUrl); Assert.AreEqual("\"" + inUrl + "\"", outUrl); // ssh in compatible form, no user inUrl = "example.org:some/path/to/repo.git"; outUrl = Plink.GetPlinkCompatibleUrl(inUrl); Assert.AreEqual("\"" + inUrl + "\"", outUrl); }
public void TestGetPlinkCompatibleUrl_NoPlink() { // Test urls that are no valid uris, these should be ignored string inUrl, outUrl; // git protocol does not have authentication inUrl = "git://server/path/to/project.git"; outUrl = Plink.GetPlinkCompatibleUrl(inUrl); Assert.AreEqual("\"" + inUrl + "\"", outUrl); // git protocol, different port inUrl = "git://*****:*****@server/path/to/project.git"; outUrl = Plink.GetPlinkCompatibleUrl(inUrl); Assert.AreEqual("\"" + inUrl + "\"", outUrl); // http, different port inUrl = "http://user@server:123/path/to/project.git"; outUrl = Plink.GetPlinkCompatibleUrl(inUrl); Assert.AreEqual("\"" + inUrl + "\"", outUrl); // http, no user inUrl = "http://server/path/to/project.git"; outUrl = Plink.GetPlinkCompatibleUrl(inUrl); Assert.AreEqual("\"" + inUrl + "\"", outUrl); // we don't need plink for https inUrl = "https://user@server/path/to/project.git"; outUrl = Plink.GetPlinkCompatibleUrl(inUrl); Assert.AreEqual("\"" + inUrl + "\"", outUrl); // https, different port inUrl = "https://user@server:123/path/to/project.git"; outUrl = Plink.GetPlinkCompatibleUrl(inUrl); Assert.AreEqual("\"" + inUrl + "\"", outUrl); // https, no user inUrl = "https://server/path/to/project.git"; outUrl = Plink.GetPlinkCompatibleUrl(inUrl); Assert.AreEqual("\"" + inUrl + "\"", outUrl); }
public void TestGetPlinkCompatibleUrl_Incompatible() { // Test urls that are incompatible and need to be changed string inUrl, expectUrl, outUrl; // ssh urls can cause problems inUrl = "ssh://[email protected]/path/to/project.git"; expectUrl = "\"[email protected]:path/to/project.git\""; outUrl = Plink.GetPlinkCompatibleUrl(inUrl); Assert.AreEqual(expectUrl, outUrl); inUrl = "ssh://[email protected]:29418/path/to/project.git"; expectUrl = "-P 29418 \"[email protected]:path/to/project.git\""; outUrl = Plink.GetPlinkCompatibleUrl(inUrl); Assert.AreEqual(expectUrl, outUrl); // ssh, no user inUrl = "ssh://example.com/path/to/project.git"; expectUrl = "\"example.com:path/to/project.git\""; outUrl = Plink.GetPlinkCompatibleUrl(inUrl); Assert.AreEqual(expectUrl, outUrl); }