Fixing unit tests

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-02-28 16:48:26 -08:00
parent 56befec173
commit 5f100afbce
3 changed files with 19 additions and 1 deletions

View File

@@ -121,6 +121,9 @@ namespace Orchard.Tests.Modules.Users.Controllers {
_controller = _container.Resolve<AccountController>();
var mockHttpContext = new Mock<HttpContextBase>();
mockHttpContext.SetupGet(x => x.Request.Url).Returns(new Uri("http://www.orchardproject.net"));
mockHttpContext.SetupGet(x => x.Request).Returns(new HttpRequestStub());
_controller.ControllerContext = new ControllerContext(
mockHttpContext.Object,
new RouteData(
@@ -353,6 +356,12 @@ namespace Orchard.Tests.Modules.Users.Controllers {
return nv;
}
}
public override string ApplicationPath {
get {
return "/";
}
}
}
}

View File

@@ -199,7 +199,12 @@ namespace Orchard.Users.Controllers {
return View();
}
_userService.SendLostPasswordEmail(username, nonce => Url.AbsoluteAction(() => Url.Action("LostPassword", "Account", new { Area = "Orchard.Users", nonce = nonce })));
var siteUrl = _orchardServices.WorkContext.CurrentSite.As<SiteSettings2Part>().BaseUrl;
if (String.IsNullOrWhiteSpace(siteUrl)) {
siteUrl = HttpContext.Request.ToRootUrlString();
}
_userService.SendLostPasswordEmail(username, nonce => Url.MakeAbsolute(Url.Action("LostPassword", "Account", new { Area = "Orchard.Users", nonce = nonce }), siteUrl));
_orchardServices.Notifier.Information(T("Check your e-mail for the confirmation link."));

View File

@@ -29,6 +29,10 @@ namespace Orchard.Mvc.Extensions {
baseUrl = urlHelper.RequestContext.HttpContext.Request.ToRootUrlString();
}
if(String.IsNullOrEmpty(url)) {
return baseUrl;
}
// remove any application path from the base url
var applicationPath = urlHelper.RequestContext.HttpContext.Request.ApplicationPath;