Beispiel #1
0
        public async Task CheckPassword_PlexUser_UserNameLogin_InvalidPassword()
        {
            var user = new OmbiUser
            {
                UserType   = UserType.PlexUser,
                EmailLogin = false,
                Email      = "*****@*****.**",
                UserName   = "******"
            };

            PlexApi.Setup(x => x.SignIn(It.IsAny <UserRequest>()))
            .ReturnsAsync(new PlexAuthentication());
            var result = await _um.CheckPasswordAsync(user, "pass");

            Assert.That(result, Is.False);
            PlexApi.Verify(x => x.SignIn(It.Is <UserRequest>(c => c.login == "heyhey")), Times.Once);
        }
Beispiel #2
0
        public async Task CheckPassword_PlexUser_EmailLogin_ValidPassword()
        {
            var user = new OmbiUser
            {
                UserType   = UserType.PlexUser,
                EmailLogin = true,
                Email      = "*****@*****.**"
            };

            PlexApi.Setup(x => x.SignIn(It.IsAny <UserRequest>()))
            .ReturnsAsync(new PlexAuthentication
            {
                user = new User
                {
                    authentication_token = "abc"
                }
            });
            var result = await _um.CheckPasswordAsync(user, "pass");

            Assert.That(result, Is.True);
            PlexApi.Verify(x => x.SignIn(It.Is <UserRequest>(c => c.login == "*****@*****.**")), Times.Once);
        }