Adding trailing slash to failing routing tests.
The issue with these tests might again be because of the UmbracoSettings file, which has the trailing slash setting. But with the settings being reset after teardown the tests were still failing, so made these minor corrections which shoudl correspond to the default setting.
This commit is contained in:
@@ -84,14 +84,14 @@ namespace Umbraco.Tests.Routing
|
||||
}
|
||||
|
||||
// test hideTopLevelNodeFromPath false
|
||||
[TestCase(1046, "/home")]
|
||||
[TestCase(1173, "/home/sub1")]
|
||||
[TestCase(1174, "/home/sub1/sub2")]
|
||||
[TestCase(1176, "/home/sub1/sub-3")]
|
||||
[TestCase(1177, "/home/sub1/custom-sub-1")]
|
||||
[TestCase(1178, "/home/sub1/custom-sub-2")]
|
||||
[TestCase(1175, "/home/sub-2")]
|
||||
[TestCase(1172, "/test-page")]
|
||||
[TestCase(1046, "/home/")]
|
||||
[TestCase(1173, "/home/sub1/")]
|
||||
[TestCase(1174, "/home/sub1/sub2/")]
|
||||
[TestCase(1176, "/home/sub1/sub-3/")]
|
||||
[TestCase(1177, "/home/sub1/custom-sub-1/")]
|
||||
[TestCase(1178, "/home/sub1/custom-sub-2/")]
|
||||
[TestCase(1175, "/home/sub-2/")]
|
||||
[TestCase(1172, "/test-page/")]
|
||||
public void Get_Nice_Url_Not_Hiding_Top_Level(int nodeId, string niceUrlMatch)
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
@@ -108,13 +108,13 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
// test hideTopLevelNodeFromPath true
|
||||
[TestCase(1046, "/")]
|
||||
[TestCase(1173, "/sub1")]
|
||||
[TestCase(1174, "/sub1/sub2")]
|
||||
[TestCase(1176, "/sub1/sub-3")]
|
||||
[TestCase(1177, "/sub1/custom-sub-1")]
|
||||
[TestCase(1178, "/sub1/custom-sub-2")]
|
||||
[TestCase(1175, "/sub-2")]
|
||||
[TestCase(1172, "/test-page")] // not hidden because not first root
|
||||
[TestCase(1173, "/sub1/")]
|
||||
[TestCase(1174, "/sub1/sub2/")]
|
||||
[TestCase(1176, "/sub1/sub-3/")]
|
||||
[TestCase(1177, "/sub1/custom-sub-1/")]
|
||||
[TestCase(1178, "/sub1/custom-sub-2/")]
|
||||
[TestCase(1175, "/sub-2/")]
|
||||
[TestCase(1172, "/test-page/")] // not hidden because not first root
|
||||
public void Get_Nice_Url_Hiding_Top_Level(int nodeId, string niceUrlMatch)
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
@@ -136,14 +136,14 @@ namespace Umbraco.Tests.Routing
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "false");
|
||||
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
Assert.AreEqual("/home/sub1/custom-sub-1", routingContext.NiceUrlProvider.GetNiceUrl(1177));
|
||||
Assert.AreEqual("/home/sub1/custom-sub-1/", routingContext.NiceUrlProvider.GetNiceUrl(1177));
|
||||
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = true;
|
||||
Assert.AreEqual("http://example.com/home/sub1/custom-sub-1", routingContext.NiceUrlProvider.GetNiceUrl(1177));
|
||||
Assert.AreEqual("http://example.com/home/sub1/custom-sub-1/", routingContext.NiceUrlProvider.GetNiceUrl(1177));
|
||||
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
routingContext.NiceUrlProvider.EnforceAbsoluteUrls = true;
|
||||
Assert.AreEqual("http://example.com/home/sub1/custom-sub-1", routingContext.NiceUrlProvider.GetNiceUrl(1177));
|
||||
Assert.AreEqual("http://example.com/home/sub1/custom-sub-1/", routingContext.NiceUrlProvider.GetNiceUrl(1177));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -181,17 +181,16 @@ namespace Umbraco.Tests.Routing
|
||||
// with one simple domain "domain1.com"
|
||||
// basic tests
|
||||
[TestCase(1001, "http://domain1.com", false, "/")]
|
||||
[TestCase(10011, "http://domain1.com", false, "/1001-1")]
|
||||
[TestCase(1002, "http://domain1.com", false, "/1002")]
|
||||
[TestCase(10011, "http://domain1.com", false, "/1001-1/")]
|
||||
[TestCase(1002, "http://domain1.com", false, "/1002/")]
|
||||
// absolute tests
|
||||
[TestCase(1001, "http://domain1.com", true, "http://domain1.com/")]
|
||||
[TestCase(10011, "http://domain1.com", true, "http://domain1.com/1001-1")]
|
||||
[TestCase(10011, "http://domain1.com", true, "http://domain1.com/1001-1/")]
|
||||
// different current tests
|
||||
[TestCase(1001, "http://domain2.com", false, "http://domain1.com/")]
|
||||
[TestCase(10011, "http://domain2.com", false, "http://domain1.com/1001-1")]
|
||||
[TestCase(10011, "http://domain2.com", false, "http://domain1.com/1001-1/")]
|
||||
[TestCase(1001, "https://domain1.com", false, "/")]
|
||||
[TestCase(10011, "https://domain1.com", false, "/1001-1")]
|
||||
|
||||
[TestCase(10011, "https://domain1.com", false, "/1001-1/")]
|
||||
public void Get_Nice_Url_SimpleDomain(int nodeId, string currentUrl, bool absolute, string expected)
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
@@ -210,18 +209,17 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
// with one complete domain "http://domain1.com/foo"
|
||||
// basic tests
|
||||
[TestCase(1001, "http://domain1.com", false, "/foo")]
|
||||
[TestCase(10011, "http://domain1.com", false, "/foo/1001-1")]
|
||||
[TestCase(1002, "http://domain1.com", false, "/1002")]
|
||||
[TestCase(1001, "http://domain1.com", false, "/foo/")]
|
||||
[TestCase(10011, "http://domain1.com", false, "/foo/1001-1/")]
|
||||
[TestCase(1002, "http://domain1.com", false, "/1002/")]
|
||||
// absolute tests
|
||||
[TestCase(1001, "http://domain1.com", true, "http://domain1.com/foo")]
|
||||
[TestCase(10011, "http://domain1.com", true, "http://domain1.com/foo/1001-1")]
|
||||
[TestCase(1001, "http://domain1.com", true, "http://domain1.com/foo/")]
|
||||
[TestCase(10011, "http://domain1.com", true, "http://domain1.com/foo/1001-1/")]
|
||||
// different current tests
|
||||
[TestCase(1001, "http://domain2.com", false, "http://domain1.com/foo")]
|
||||
[TestCase(10011, "http://domain2.com", false, "http://domain1.com/foo/1001-1")]
|
||||
[TestCase(1001, "https://domain1.com", false, "http://domain1.com/foo")]
|
||||
[TestCase(10011, "https://domain1.com", false, "http://domain1.com/foo/1001-1")]
|
||||
|
||||
[TestCase(1001, "http://domain2.com", false, "http://domain1.com/foo/")]
|
||||
[TestCase(10011, "http://domain2.com", false, "http://domain1.com/foo/1001-1/")]
|
||||
[TestCase(1001, "https://domain1.com", false, "http://domain1.com/foo/")]
|
||||
[TestCase(10011, "https://domain1.com", false, "http://domain1.com/foo/1001-1/")]
|
||||
public void Get_Nice_Url_SimpleWithSchemeAndPath(int nodeId, string currentUrl, bool absolute, string expected)
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
@@ -239,11 +237,10 @@ namespace Umbraco.Tests.Routing
|
||||
}
|
||||
|
||||
// with one domain, not at root
|
||||
[TestCase(1001, "http://domain1.com", false, "/1001")]
|
||||
[TestCase(1001, "http://domain1.com", false, "/1001/")]
|
||||
[TestCase(10011, "http://domain1.com", false, "/")]
|
||||
[TestCase(100111, "http://domain1.com", false, "/1001-1-1")]
|
||||
[TestCase(1002, "http://domain1.com", false, "/1002")]
|
||||
|
||||
[TestCase(100111, "http://domain1.com", false, "/1001-1-1/")]
|
||||
[TestCase(1002, "http://domain1.com", false, "/1002/")]
|
||||
public void Get_Nice_Url_DeepDomain(int nodeId, string currentUrl, bool absolute, string expected)
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
@@ -262,16 +259,15 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
// with nested domains
|
||||
[TestCase(1001, "http://domain1.com", false, "/")]
|
||||
[TestCase(10011, "http://domain1.com", false, "/en")]
|
||||
[TestCase(100111, "http://domain1.com", false, "/en/1001-1-1")]
|
||||
[TestCase(10012, "http://domain1.com", false, "/fr")]
|
||||
[TestCase(100121, "http://domain1.com", false, "/fr/1001-2-1")]
|
||||
[TestCase(10013, "http://domain1.com", false, "/1001-3")]
|
||||
[TestCase(1002, "http://domain1.com", false, "/1002")]
|
||||
[TestCase(10011, "http://domain1.com", false, "/en/")]
|
||||
[TestCase(100111, "http://domain1.com", false, "/en/1001-1-1/")]
|
||||
[TestCase(10012, "http://domain1.com", false, "/fr/")]
|
||||
[TestCase(100121, "http://domain1.com", false, "/fr/1001-2-1/")]
|
||||
[TestCase(10013, "http://domain1.com", false, "/1001-3/")]
|
||||
[TestCase(1002, "http://domain1.com", false, "/1002/")]
|
||||
[TestCase(1003, "http://domain3.com", false, "/")]
|
||||
[TestCase(10031, "http://domain3.com", false, "/en")]
|
||||
[TestCase(100321, "http://domain3.com", false, "/fr/1003-2-1")]
|
||||
|
||||
[TestCase(10031, "http://domain3.com", false, "/en/")]
|
||||
[TestCase(100321, "http://domain3.com", false, "/fr/1003-2-1/")]
|
||||
public void Get_Nice_Url_NestedDomains(int nodeId, string currentUrl, bool absolute, string expected)
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
@@ -329,14 +325,14 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
// use the cache
|
||||
Assert.AreEqual("/", routingContext.NiceUrlProvider.GetNiceUrl(1001, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/en", routingContext.NiceUrlProvider.GetNiceUrl(10011, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/en/1001-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100111, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/fr", routingContext.NiceUrlProvider.GetNiceUrl(10012, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/fr/1001-2-1", routingContext.NiceUrlProvider.GetNiceUrl(100121, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/1001-3", routingContext.NiceUrlProvider.GetNiceUrl(10013, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/1002", routingContext.NiceUrlProvider.GetNiceUrl(1002, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/en/", routingContext.NiceUrlProvider.GetNiceUrl(10011, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/en/1001-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100111, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/fr/", routingContext.NiceUrlProvider.GetNiceUrl(10012, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/fr/1001-2-1/", routingContext.NiceUrlProvider.GetNiceUrl(100121, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/1001-3/", routingContext.NiceUrlProvider.GetNiceUrl(10013, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/1002/", routingContext.NiceUrlProvider.GetNiceUrl(1002, new Uri("http://domain1.com"), false));
|
||||
|
||||
Assert.AreEqual("http://domain1.com/fr/1001-2-1", routingContext.NiceUrlProvider.GetNiceUrl(100121, new Uri("http://domain2.com"), false));
|
||||
Assert.AreEqual("http://domain1.com/fr/1001-2-1/", routingContext.NiceUrlProvider.GetNiceUrl(100121, new Uri("http://domain2.com"), false));
|
||||
}
|
||||
|
||||
void CheckRoute(IDictionary<int, string> routes, IDictionary<string, int> ids, int id, string route)
|
||||
@@ -359,17 +355,17 @@ namespace Umbraco.Tests.Routing
|
||||
SetDomains4();
|
||||
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
Assert.AreEqual("/en/1001-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100111));
|
||||
Assert.AreEqual("http://domain3.com/en/1003-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100311));
|
||||
Assert.AreEqual("/en/1001-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100111));
|
||||
Assert.AreEqual("http://domain3.com/en/1003-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100311));
|
||||
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = true;
|
||||
Assert.AreEqual("http://domain1.com/en/1001-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100111));
|
||||
Assert.AreEqual("http://domain3.com/en/1003-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100311));
|
||||
Assert.AreEqual("http://domain1.com/en/1001-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100111));
|
||||
Assert.AreEqual("http://domain3.com/en/1003-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100311));
|
||||
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
routingContext.NiceUrlProvider.EnforceAbsoluteUrls = true;
|
||||
Assert.AreEqual("http://domain1.com/en/1001-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100111));
|
||||
Assert.AreEqual("http://domain3.com/en/1003-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100311));
|
||||
Assert.AreEqual("http://domain1.com/en/1001-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100111));
|
||||
Assert.AreEqual("http://domain3.com/en/1003-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100311));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -389,9 +385,9 @@ namespace Umbraco.Tests.Routing
|
||||
// all of them
|
||||
// including the local one - duplicate?! - then must manually exclude?
|
||||
Assert.AreEqual(3, result.Count());
|
||||
Assert.IsTrue(result.Contains("http://domain1.com/en/1001-1-1"));
|
||||
Assert.IsTrue(result.Contains("http://domain1a.com/en/1001-1-1"));
|
||||
Assert.IsTrue(result.Contains("http://domain1b.com/en/1001-1-1"));
|
||||
Assert.IsTrue(result.Contains("http://domain1.com/en/1001-1-1/"));
|
||||
Assert.IsTrue(result.Contains("http://domain1a.com/en/1001-1-1/"));
|
||||
Assert.IsTrue(result.Contains("http://domain1b.com/en/1001-1-1/"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
// get the nice url for 100111
|
||||
routingContext = GetRoutingContext(url);
|
||||
Assert.AreEqual("http://domain2.com/1001-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100111, true));
|
||||
Assert.AreEqual("http://domain2.com/1001-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100111, true));
|
||||
|
||||
// check that the proper route has been cached
|
||||
var cachedRoutes = ((DefaultRoutesCache)routingContext.UmbracoContext.RoutesCache).GetCachedRoutes();
|
||||
@@ -60,7 +60,7 @@ namespace Umbraco.Tests.Routing
|
||||
//Assert.AreEqual("1001/1001-1/1001-1-1", cachedRoutes[100111]); // yes
|
||||
|
||||
// what's the nice url now?
|
||||
Assert.AreEqual("http://domain2.com/1001-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100111)); // good
|
||||
Assert.AreEqual("http://domain2.com/1001-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100111)); // good
|
||||
//Assert.AreEqual("http://domain1.com/1001-1/1001-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100111, true)); // bad
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user