# Path: pyvac/tests/case.py
# class UnauthenticatedViewTestCase(TestCase):
# 
#     mocks = []
# 
#     def __init__(self, methodName='runTest'):
#         super(UnauthenticatedViewTestCase, self).__init__(methodName)
#         # pylint: disable=W0142
#         self.mocks = [patch(*mock_args) for mock_args in self.mocks]
#         self.maxDiff = None
# 
#     def setUp(self):
#         from pyvac.config import includeme
#         from .conf import settings
#         super(UnauthenticatedViewTestCase, self).setUp()
#         self.maxDiff = None
#         # authz_policy = ACLAuthorizationPolicy()
#         self.config = testing.setUp(settings=settings)
#         self.config.include(includeme)
#         self.session = DBSession()
#         transaction.begin()
# 
#         for dummy in self.mocks:
#             dummy.start()
# 
#     def tearDown(self):
#         super(UnauthenticatedViewTestCase, self).tearDown()
#         self.session.flush()
#         transaction.commit()
#         testing.tearDown()
# 
#         for dummy in reversed(self.mocks):
#             dummy.stop()
# 
#     def create_request(self, params=None, environ=None, matchdict=None,
#                        headers=None, path='/', cookies=None, post=None, **kw):
#         if params and not isinstance(params, MultiDict):
#             mparams = MultiDict()
#             for k, v in params.items():
#                 mparams.add(k, v)
#                 params = mparams
# 
#         rv = DummyRequest(params, environ, headers, path, cookies,
#                           post, matchdict=(matchdict or {}), **kw)
#         return rv
# 
#     def assertIsRedirect(self, view):
#         self.assertIsInstance(view, HTTPFound)


from .case import UnauthenticatedViewTestCase
        from pyvac.security import RootFactory
        from pyvac.security import groupfinder
        from pyvac.security import groupfinder
        from pyvac.security import groupfinder


class RootFactoryTestCase(UnauthenticatedViewTestCase):

    def test_get_acl_admin(self):
        root = RootFactory(self.create_request())
        self.assertEqual(set(root.__acl__),
                         set([
                             ('Allow', 'admin', 'admin_view'),
                             ('Allow', 'admin', 'manager_view'),
                             ('Allow', 'admin', 'user_view'),
                             ('Allow', 'admin', 'sudo_view'),
                             ('Allow', 'manager', 'manager_view'),
                             ('Allow', 'manager', 'user_view'),
                             ('Allow', 'manager', 'sudo_view'),
                             ('Allow', 'user', 'user_view'),
                             ('Allow', 'sudoer', 'sudo_view')]))



# Path: pyvac/tests/case.py
# class UnauthenticatedViewTestCase(TestCase):
# 
#     mocks = []
# 
#     def __init__(self, methodName='runTest'):
#         super(UnauthenticatedViewTestCase, self).__init__(methodName)
#         # pylint: disable=W0142
#         self.mocks = [patch(*mock_args) for mock_args in self.mocks]
#         self.maxDiff = None
# 
#     def setUp(self):
#         from pyvac.config import includeme
#         from .conf import settings
#         super(UnauthenticatedViewTestCase, self).setUp()
#         self.maxDiff = None
#         # authz_policy = ACLAuthorizationPolicy()
#         self.config = testing.setUp(settings=settings)
#         self.config.include(includeme)
#         self.session = DBSession()
#         transaction.begin()
# 
#         for dummy in self.mocks:
#             dummy.start()
# 
#     def tearDown(self):
#         super(UnauthenticatedViewTestCase, self).tearDown()
#         self.session.flush()
#         transaction.commit()
#         testing.tearDown()
# 
#         for dummy in reversed(self.mocks):
#             dummy.stop()
# 
#     def create_request(self, params=None, environ=None, matchdict=None,
#                        headers=None, path='/', cookies=None, post=None, **kw):
#         if params and not isinstance(params, MultiDict):
#             mparams = MultiDict()
#             for k, v in params.items():
#                 mparams.add(k, v)
#                 params = mparams
# 
#         rv = DummyRequest(params, environ, headers, path, cookies,
#                           post, matchdict=(matchdict or {}), **kw)
#         return rv
# 
#     def assertIsRedirect(self, view):
#         self.assertIsInstance(view, HTTPFound)


# Path: pyvac/tests/test_security.py
from .case import UnauthenticatedViewTestCase
        from pyvac.security import RootFactory
        from pyvac.security import groupfinder
        from pyvac.security import groupfinder
        from pyvac.security import groupfinder



class RootFactoryTestCase(UnauthenticatedViewTestCase):

    def test_get_acl_admin(self):
        root = RootFactory(self.create_request())
        self.assertEqual(set(root.__acl__),
                         set([
                             ('Allow', 'admin', 'admin_view'),
                             ('Allow', 'admin', 'manager_view'),
                             ('Allow', 'admin', 'user_view'),
                             ('Allow', 'admin', 'sudo_view'),
                             ('Allow', 'manager', 'manager_view'),
                             ('Allow', 'manager', 'user_view'),
                             ('Allow', 'manager', 'sudo_view'),
                             ('Allow', 'user', 'user_view'),
                             ('Allow', 'sudoer', 'sudo_view')]))



class GroupFinderTestCase(UnauthenticatedViewTestCase):