# Path: papaye/tests/tools.py
# class FakeRoute():
# 
#     def __init__(self, name):
#         self.name = name


from pyramid import testing
from papaye.tests.tools import FakeRoute
    from papaye.authentification import RouteNameAuthPolicy
    from pyramid.authentication import AuthTktAuthenticationPolicy
    from papaye.authentification import RouteNameAuthPolicy
    from pyramid.authentication import AuthTktAuthenticationPolicy
    from papaye.authentification import RouteNameAuthPolicy
    from pyramid.authentication import AuthTktAuthenticationPolicy
    from papaye.authentification import RouteNameAuthPolicy
    from pyramid.authentication import AuthTktAuthenticationPolicy
    from papaye.authentification import RouteNameAuthPolicy
    from pyramid.authentication import AuthTktAuthenticationPolicy



def test_instanciate():
    auth_policy = AuthTktAuthenticationPolicy('seekreet', hashalg='sha512')

    policy = RouteNameAuthPolicy(home=auth_policy)

    assert policy.policies == {'home': auth_policy}


def test_instanciate_multiple_policies():
    auth_policy = AuthTktAuthenticationPolicy('seekreet', hashalg='sha512')
    auth_policy2 = AuthTktAuthenticationPolicy('seekreet_again', hashalg='sha512')

    policy = RouteNameAuthPolicy(home=auth_policy, index=auth_policy2)

    assert policy.policies == {'home': auth_policy, 'index': auth_policy2}


def test_get_policy():
    auth_policy = AuthTktAuthenticationPolicy('seekreet', hashalg='sha512')
    policy = RouteNameAuthPolicy(home=auth_policy)

# Path: papaye/tests/tools.py
# class FakeRoute():
# 
#     def __init__(self, name):
#         self.name = name


# Path: papaye/tests/test_authentification.py
from pyramid import testing
from papaye.tests.tools import FakeRoute
    from papaye.authentification import RouteNameAuthPolicy
    from pyramid.authentication import AuthTktAuthenticationPolicy
    from papaye.authentification import RouteNameAuthPolicy
    from pyramid.authentication import AuthTktAuthenticationPolicy
    from papaye.authentification import RouteNameAuthPolicy
    from pyramid.authentication import AuthTktAuthenticationPolicy
    from papaye.authentification import RouteNameAuthPolicy
    from pyramid.authentication import AuthTktAuthenticationPolicy
    from papaye.authentification import RouteNameAuthPolicy
    from pyramid.authentication import AuthTktAuthenticationPolicy




def test_instanciate():
    auth_policy = AuthTktAuthenticationPolicy('seekreet', hashalg='sha512')

    policy = RouteNameAuthPolicy(home=auth_policy)

    assert policy.policies == {'home': auth_policy}


def test_instanciate_multiple_policies():
    auth_policy = AuthTktAuthenticationPolicy('seekreet', hashalg='sha512')
    auth_policy2 = AuthTktAuthenticationPolicy('seekreet_again', hashalg='sha512')

    policy = RouteNameAuthPolicy(home=auth_policy, index=auth_policy2)

    assert policy.policies == {'home': auth_policy, 'index': auth_policy2}


def test_get_policy():
    auth_policy = AuthTktAuthenticationPolicy('seekreet', hashalg='sha512')
    policy = RouteNameAuthPolicy(home=auth_policy)

    request = testing.DummyRequest(matched_route=FakeRoute('home'))