Esempio n. 1
0
def test_login_required_no_url(mongodb, request):
    inbound(request)
    login_required(request)
    request.redirect.assert_called_with("/account/login.html")
Esempio n. 2
0
def test_authenticated_user_passes(mongodb, user, request):
    request.session["auth_user_id"] = "Paul"
    inbound(request)
    login_required(request, "/login.html")
Esempio n. 3
0
def test_login_required(mongodb, request):
    inbound(request)
    login_required(request, "/login.html")
    request.redirect.assert_called_with("/login.html")
Esempio n. 4
0
def test_inbound_user_notexists(mongodb, request):
    request.session["auth_user_id"] = "Paul"
    inbound(request)
    assert request.user == None
    assert request.authenticated == False
Esempio n. 5
0
def test_inbound_user(mongodb, user, request):
    request.session["auth_user_id"] = "Paul"
    inbound(request)
    assert request.user == user
    assert request.authenticated == True
Esempio n. 6
0
def test_inbound_nouser(mongodb, request):
    request = Mock()
    request.session = {"session_key": "a" * 64}
    inbound(request)
    assert request.user == None
    assert request.authenticated == False