Removed the service locator from the base classes and added in some Api tests

added all the tests back in!
This commit is contained in:
tidusjar 2016-05-19 17:02:46 +01:00
parent 187a59261a
commit 84dc4515fd
21 changed files with 251 additions and 176 deletions

View file

@ -75,20 +75,23 @@ namespace PlexRequests.UI.Modules
}
}
protected BaseAuthModule()
protected BaseAuthModule(ISettingsService<PlexRequestSettings> pr) : base(pr)
{
Service = pr;
Before += (ctx) => CheckAuth();
}
protected BaseAuthModule(string modulePath) : base(modulePath)
protected BaseAuthModule(string modulePath, ISettingsService<PlexRequestSettings> pr) : base(modulePath, pr)
{
Service = pr;
Before += (ctx) => CheckAuth();
}
private ISettingsService<PlexRequestSettings> Service { get; }
private Response CheckAuth()
{
var settings = Locator.Resolve<ISettingsService<PlexRequestSettings>>().GetSettings();
var settings = Service.GetSettings();
var baseUrl = settings.BaseUrl;
var redirectPath = string.IsNullOrEmpty(baseUrl) ? "~/userlogin" : $"~/{baseUrl}/userlogin";