예제 #1
0
    def test_change_password(self):
        user = User(password=User.hash_password('password1'))
        assert user.verify_password('password1')

        with patch.object(User, '_save', return_value=make_future()):
            yield user.change_password('password1', 'password2')

            assert user.verify_password('password2')
            assert User._save.call_count == 1
예제 #2
0
    def test_change_password(self):
        user = User(password=User.hash_password('password1'))
        assert user.verify_password('password1')

        with patch.object(User, '_save', return_value=make_future()):
            yield user.change_password('password1', 'password2')

            assert user.verify_password('password2')
            assert User._save.call_count == 1
예제 #3
0
    def test_change_password_incorrect_password(self):
        user = User(password=User.hash_password('password1'))

        with pytest.raises(exceptions.Unauthorized):
            yield user.change_password('password2', 'password3')
예제 #4
0
    def test_change_password_incorrect_password(self):
        user = User(password=User.hash_password('password1'))

        with pytest.raises(exceptions.Unauthorized):
            yield user.change_password('password2', 'password3')