|
|
|
@ -37,7 +37,6 @@ using NUnit.Framework;
|
|
|
|
|
|
|
|
|
|
using PlexRequests.Api.Interfaces;
|
|
|
|
|
using PlexRequests.Api.Models;
|
|
|
|
|
using PlexRequests.Api.Models.Tv;
|
|
|
|
|
using PlexRequests.Core;
|
|
|
|
|
using PlexRequests.Core.SettingModels;
|
|
|
|
|
using PlexRequests.UI.Models;
|
|
|
|
@ -75,7 +74,6 @@ namespace PlexRequests.UI.Tests
|
|
|
|
|
bootstrapper.WithSession(new Dictionary<string, object>());
|
|
|
|
|
|
|
|
|
|
var browser = new Browser(bootstrapper);
|
|
|
|
|
// When
|
|
|
|
|
var result = browser.Post("/userlogin", with =>
|
|
|
|
|
{
|
|
|
|
|
with.HttpRequest();
|
|
|
|
@ -83,13 +81,14 @@ namespace PlexRequests.UI.Tests
|
|
|
|
|
with.FormValue("Username", "abc");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Then
|
|
|
|
|
Assert.That(HttpStatusCode.OK, Is.EqualTo(result.StatusCode));
|
|
|
|
|
Assert.That(result.Context.Request.Session[SessionKeys.UsernameKey], Is.EqualTo("abc"));
|
|
|
|
|
|
|
|
|
|
var body = JsonConvert.DeserializeObject<JsonResponseModel>(result.Body.AsString());
|
|
|
|
|
Assert.That(body.Result, Is.EqualTo(true));
|
|
|
|
|
|
|
|
|
|
AuthMock.Verify(x => x.GetSettings(), Times.Once);
|
|
|
|
|
PlexMock.Verify(x => x.SignIn(It.IsAny<string>(), It.IsAny<string>()), Times.Never);
|
|
|
|
|
PlexMock.Verify(x => x.GetUsers(It.IsAny<string>()), Times.Never);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
@ -121,7 +120,6 @@ namespace PlexRequests.UI.Tests
|
|
|
|
|
bootstrapper.WithSession(new Dictionary<string, object>());
|
|
|
|
|
|
|
|
|
|
var browser = new Browser(bootstrapper);
|
|
|
|
|
// When
|
|
|
|
|
var result = browser.Post("/userlogin", with =>
|
|
|
|
|
{
|
|
|
|
|
with.HttpRequest();
|
|
|
|
@ -129,13 +127,14 @@ namespace PlexRequests.UI.Tests
|
|
|
|
|
with.FormValue("Username", "abc");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Then
|
|
|
|
|
Assert.That(HttpStatusCode.OK, Is.EqualTo(result.StatusCode));
|
|
|
|
|
Assert.That(result.Context.Request.Session[SessionKeys.UsernameKey], Is.EqualTo("abc"));
|
|
|
|
|
|
|
|
|
|
var body = JsonConvert.DeserializeObject<JsonResponseModel>(result.Body.AsString());
|
|
|
|
|
Assert.That(body.Result, Is.EqualTo(true));
|
|
|
|
|
|
|
|
|
|
AuthMock.Verify(x => x.GetSettings(), Times.Once);
|
|
|
|
|
PlexMock.Verify(x => x.SignIn(It.IsAny<string>(), It.IsAny<string>()), Times.Never);
|
|
|
|
|
PlexMock.Verify(x => x.GetUsers(It.IsAny<string>()), Times.Once);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
@ -182,6 +181,9 @@ namespace PlexRequests.UI.Tests
|
|
|
|
|
var body = JsonConvert.DeserializeObject<JsonResponseModel>(result.Body.AsString());
|
|
|
|
|
Assert.That(body.Result, Is.EqualTo(false));
|
|
|
|
|
Assert.That(body.Message, Is.Not.Empty);
|
|
|
|
|
AuthMock.Verify(x => x.GetSettings(), Times.Once);
|
|
|
|
|
PlexMock.Verify(x => x.SignIn(It.IsAny<string>(), It.IsAny<string>()), Times.Never);
|
|
|
|
|
PlexMock.Verify(x => x.GetUsers(It.IsAny<string>()), Times.Once);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
@ -221,7 +223,6 @@ namespace PlexRequests.UI.Tests
|
|
|
|
|
bootstrapper.WithSession(new Dictionary<string, object>());
|
|
|
|
|
|
|
|
|
|
var browser = new Browser(bootstrapper);
|
|
|
|
|
// When
|
|
|
|
|
var result = browser.Post("/userlogin", with =>
|
|
|
|
|
{
|
|
|
|
|
with.HttpRequest();
|
|
|
|
@ -230,13 +231,15 @@ namespace PlexRequests.UI.Tests
|
|
|
|
|
with.FormValue("Password", "abc");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Then
|
|
|
|
|
|
|
|
|
|
Assert.That(HttpStatusCode.OK, Is.EqualTo(result.StatusCode));
|
|
|
|
|
Assert.That(result.Context.Request.Session[SessionKeys.UsernameKey], Is.EqualTo("abc"));
|
|
|
|
|
|
|
|
|
|
var body = JsonConvert.DeserializeObject<JsonResponseModel>(result.Body.AsString());
|
|
|
|
|
Assert.That(body.Result, Is.EqualTo(true));
|
|
|
|
|
|
|
|
|
|
AuthMock.Verify(x => x.GetSettings(), Times.Once);
|
|
|
|
|
PlexMock.Verify(x => x.SignIn(It.IsAny<string>(), It.IsAny<string>()), Times.Once);
|
|
|
|
|
PlexMock.Verify(x => x.GetUsers(It.IsAny<string>()), Times.Once);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
@ -273,7 +276,6 @@ namespace PlexRequests.UI.Tests
|
|
|
|
|
bootstrapper.WithSession(new Dictionary<string, object>());
|
|
|
|
|
|
|
|
|
|
var browser = new Browser(bootstrapper);
|
|
|
|
|
// When
|
|
|
|
|
var result = browser.Post("/userlogin", with =>
|
|
|
|
|
{
|
|
|
|
|
with.HttpRequest();
|
|
|
|
@ -282,14 +284,16 @@ namespace PlexRequests.UI.Tests
|
|
|
|
|
with.FormValue("Password", "abc");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Then
|
|
|
|
|
|
|
|
|
|
Assert.That(HttpStatusCode.OK, Is.EqualTo(result.StatusCode));
|
|
|
|
|
Assert.That(result.Context.Request.Session[SessionKeys.UsernameKey], Is.EqualTo("abc"));
|
|
|
|
|
|
|
|
|
|
var body = JsonConvert.DeserializeObject<JsonResponseModel>(result.Body.AsString());
|
|
|
|
|
Assert.That(body.Result, Is.EqualTo(false));
|
|
|
|
|
Assert.That(body.Message, Is.Not.Empty);
|
|
|
|
|
|
|
|
|
|
AuthMock.Verify(x => x.GetSettings(), Times.Once);
|
|
|
|
|
PlexMock.Verify(x => x.SignIn(It.IsAny<string>(), It.IsAny<string>()), Times.Once);
|
|
|
|
|
PlexMock.Verify(x => x.GetUsers(It.IsAny<string>()), Times.Never);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|