Added user logout method and unit tests to cover it

This commit is contained in:
tidusjar 2016-03-09 12:59:07 +00:00
parent 55560611e8
commit 759540c837
4 changed files with 51 additions and 6 deletions

View file

@ -330,5 +330,29 @@ namespace PlexRequests.UI.Tests
PlexMock.Verify(x => x.SignIn(It.IsAny<string>(), It.IsAny<string>()), Times.Never);
PlexMock.Verify(x => x.GetUsers(It.IsAny<string>()), Times.Never);
}
[Test]
public void Logout()
{
var bootstrapper = new ConfigurableBootstrapper(with =>
{
with.Module<UserLoginModule>();
with.Dependency(AuthMock.Object);
with.Dependency(PlexMock.Object);
with.RootPathProvider<TestRootPathProvider>();
});
bootstrapper.WithSession(new Dictionary<string, object> { {SessionKeys.UsernameKey, "abc"} });
var browser = new Browser(bootstrapper);
var result = browser.Get("/userlogin/logout", with =>
{
with.HttpRequest();
with.Header("Accept", "application/json");
});
Assert.That(HttpStatusCode.SeeOther, Is.EqualTo(result.StatusCode));
Assert.That(result.Context.Request.Session[SessionKeys.UsernameKey], Is.Null);
}
}
}