Esempio n. 1
0
def test_login_user_success():
    old_session_id = mod.request.session.id
    username = '******'
    password = '******'
    mod.create_user(username, password)
    assert mod.login_user(username, password)
    assert mod.request.session.id != old_session_id
    assert mod.request.user.is_authenticated
    assert mod.request.user.username == username
    assert mod.request.user.options.to_native() == {}
Esempio n. 2
0
def test_logout():
    old_session_id = mod.request.session.id
    username = '******'
    password = '******'
    mod.create_user(username, password)

    assert mod.login_user(username, password)
    new_session_id = mod.request.session.id
    assert new_session_id != old_session_id
    assert mod.request.user.is_authenticated
    assert mod.request.user.username == username
    assert_session_count_is(1)

    mod.request.user.logout()

    assert mod.request.session.id != new_session_id
    assert_session_count_is(0)
Esempio n. 3
0
def test_login_user_invalid_username():
    username = '******'
    password = '******'
    mod.create_user(username, password)
    assert mod.login_user('missing', 'invalid') is False
    assert not mod.request.user.is_authenticated