# Path: pyvac/tests/case.py
# class ModelTestCase(TestCase):
# class DummyRoute(object):
# class DummyRequest(testing.DummyRequest):
# class UnauthenticatedViewTestCase(TestCase):
# class ViewTestCase(UnauthenticatedViewTestCase):
# class ViewAdminTestCase(ViewTestCase):
#     def setUp(self):
#     def tearDown(self):
#     def auto_translate(string, country):
#     def __init__(self, methodName='runTest'):
#     def setUp(self):
#     def tearDown(self):
#     def create_request(self, params=None, environ=None, matchdict=None,
#                        headers=None, path='/', cookies=None, post=None, **kw):
#     def assertIsRedirect(self, view):
#     def setUp(self):
#     def set_userid(self, userid='admin', permissive=False):
#     def setUp(self):


from pyvac.tests import case
        from pyvac.models import User, Group, Countries
        from pyvac.models import User
        from pyvac.views.credentials import Login
        from pyvac.views.credentials import Login
        from pyvac.views.credentials import Logout
        from pyvac.views.credentials import Login
        from pyvac.views.credentials import Login
        from pyvac.views.credentials import Sudo
        from pyvac.views.credentials import Sudo
        from pyvac.views.credentials import Sudo
        import uuid
        self.account_todelete = [self.account_id]

    def tearDown(self):
        for id in self.account_todelete:
            u = User.by_id(self.session, id)
            self.session.delete(u)
        super(AccountTestCase, self).tearDown()

    def test_login_unknown(self):
        request = self.create_request()
        view = Login(request)()
        self.assertEqual(set(view.keys()),
                         set(['pyvac', 'csrf_token', 'came_from']))

        self.assertEqual(view['came_from'], 'http://pyvac.example.net')

    def test_login_ok(self):
        request = self.create_request({'submit': '1',
                                       'login': self.account_login,
                                       'password': 'secret',
                                       })
        view = Login(request)()
        self.assertIsRedirect(view)

    def test_logout_ok(self):
        request = self.create_request()
        view = Logout(request)()
        self.assertIsRedirect(view)



# Path: pyvac/tests/case.py
# class ModelTestCase(TestCase):
# class DummyRoute(object):
# class DummyRequest(testing.DummyRequest):
# class UnauthenticatedViewTestCase(TestCase):
# class ViewTestCase(UnauthenticatedViewTestCase):
# class ViewAdminTestCase(ViewTestCase):
#     def setUp(self):
#     def tearDown(self):
#     def auto_translate(string, country):
#     def __init__(self, methodName='runTest'):
#     def setUp(self):
#     def tearDown(self):
#     def create_request(self, params=None, environ=None, matchdict=None,
#                        headers=None, path='/', cookies=None, post=None, **kw):
#     def assertIsRedirect(self, view):
#     def setUp(self):
#     def set_userid(self, userid='admin', permissive=False):
#     def setUp(self):


# Path: pyvac/tests/views/test_credentials.py
from pyvac.tests import case
        from pyvac.models import User, Group, Countries
        from pyvac.models import User
        from pyvac.views.credentials import Login
        from pyvac.views.credentials import Login
        from pyvac.views.credentials import Logout
        from pyvac.views.credentials import Login
        from pyvac.views.credentials import Login
        from pyvac.views.credentials import Sudo
        from pyvac.views.credentials import Sudo
        from pyvac.views.credentials import Sudo
        import uuid

        self.account_todelete = [self.account_id]

    def tearDown(self):
        for id in self.account_todelete:
            u = User.by_id(self.session, id)
            self.session.delete(u)
        super(AccountTestCase, self).tearDown()

    def test_login_unknown(self):
        request = self.create_request()
        view = Login(request)()
        self.assertEqual(set(view.keys()),
                         set(['pyvac', 'csrf_token', 'came_from']))

        self.assertEqual(view['came_from'], 'http://pyvac.example.net')

    def test_login_ok(self):
        request = self.create_request({'submit': '1',
                                       'login': self.account_login,
                                       'password': 'secret',
                                       })
        view = Login(request)()
        self.assertIsRedirect(view)

    def test_logout_ok(self):
        request = self.create_request()
        view = Logout(request)()
        self.assertIsRedirect(view)



class SudoTestCase(case.ViewTestCase):