# Path: tests_python/util_tests.py
# class TestLogin(TestApp):
# 
#     def setUp(self):
#         super(TestLogin, self).setUp()
#         self.auth_methods = [
#                 NullAuth(name='Null Auth 1'),
#                 NullAuth(name='Null Auth 2'),
#         ]
#         self.app.config['SRP_AUTH_METHODS'] = self.auth_methods
#         init_app(self.app)
#         self.normal_name = 'Normal User'
#         self.admin_name = 'Admin User'
#         self.default_authmethod = self.auth_methods[0]
#         with self.app.test_request_context():
#             db.session.add(User(self.normal_name,
#                 self.default_authmethod.name))
#             admin_user = User(self.admin_name, self.default_authmethod.name)
#             admin_user.admin = True
#             db.session.add(admin_user)
#             db.session.commit()
# 
#     def login(self, username=None):
#         if username is None:
#             username = self.normal_name
#         client = self.app.test_client()
#         data = {
#             'name': username,
#             'submit': 'true',
#         }
#         auth_method = self.auth_methods[0]
#         data = {auth_method.safe_name + '-' + field: value for field, value in
#                 data.items()}
#         client.post('/login/', follow_redirects=True, data=data)
#         return client
# 
#     @property
#     def normal_user(self):
#         return User.query.filter_by(name=self.normal_name).one()
# 
#     @property
#     def admin_user(self):
#         return User.query.filter_by(name=self.admin_name).one()


from ..util_tests import TestLogin
from evesrp import db
from evesrp.auth import PermissionType
from evesrp.auth.models import User, Group, Division, Permission
from evesrp.transformers import Transformer
import evesrp
        resp = client.post('/division/add/', follow_redirects=True,
                data={'name': 'Test Division'})
        self.assertEqual(resp.status_code, 200)
        with self.app.test_request_context():
            divisions = Division.query.all()
            self.assertEqual(len(divisions), 1)
            self.assertEqual(divisions[0].name, 'Test Division')


class TestListDivisions(TestLogin):

    def setUp(self):
        super(TestListDivisions, self).setUp()
        with self.app.test_request_context():
            divisions = [
                Division('Division One'),
                Division('Division Two'),
                Division('Division Three'),
            ]
            db.session.add_all(divisions)
            db.session.commit()

    def test_list_divisions(self):
        client = self.login(self.admin_name)
        resp = client.get('/division/', follow_redirects=True)
        self.assertIn('Division One', resp.get_data(as_text=True))
        self.assertIn('Division Two', resp.get_data(as_text=True))
        self.assertIn('Division Three', resp.get_data(as_text=True))



# Path: tests_python/util_tests.py
# class TestLogin(TestApp):
# 
#     def setUp(self):
#         super(TestLogin, self).setUp()
#         self.auth_methods = [
#                 NullAuth(name='Null Auth 1'),
#                 NullAuth(name='Null Auth 2'),
#         ]
#         self.app.config['SRP_AUTH_METHODS'] = self.auth_methods
#         init_app(self.app)
#         self.normal_name = 'Normal User'
#         self.admin_name = 'Admin User'
#         self.default_authmethod = self.auth_methods[0]
#         with self.app.test_request_context():
#             db.session.add(User(self.normal_name,
#                 self.default_authmethod.name))
#             admin_user = User(self.admin_name, self.default_authmethod.name)
#             admin_user.admin = True
#             db.session.add(admin_user)
#             db.session.commit()
# 
#     def login(self, username=None):
#         if username is None:
#             username = self.normal_name
#         client = self.app.test_client()
#         data = {
#             'name': username,
#             'submit': 'true',
#         }
#         auth_method = self.auth_methods[0]
#         data = {auth_method.safe_name + '-' + field: value for field, value in
#                 data.items()}
#         client.post('/login/', follow_redirects=True, data=data)
#         return client
# 
#     @property
#     def normal_user(self):
#         return User.query.filter_by(name=self.normal_name).one()
# 
#     @property
#     def admin_user(self):
#         return User.query.filter_by(name=self.admin_name).one()


# Path: tests_python/views/test_divisions.py
from ..util_tests import TestLogin
from evesrp import db
from evesrp.auth import PermissionType
from evesrp.auth.models import User, Group, Division, Permission
from evesrp.transformers import Transformer
import evesrp

        resp = client.post('/division/add/', follow_redirects=True,
                data={'name': 'Test Division'})
        self.assertEqual(resp.status_code, 200)
        with self.app.test_request_context():
            divisions = Division.query.all()
            self.assertEqual(len(divisions), 1)
            self.assertEqual(divisions[0].name, 'Test Division')


class TestListDivisions(TestLogin):

    def setUp(self):
        super(TestListDivisions, self).setUp()
        with self.app.test_request_context():
            divisions = [
                Division('Division One'),
                Division('Division Two'),
                Division('Division Three'),
            ]
            db.session.add_all(divisions)
            db.session.commit()

    def test_list_divisions(self):
        client = self.login(self.admin_name)
        resp = client.get('/division/', follow_redirects=True)
        self.assertIn('Division One', resp.get_data(as_text=True))
        self.assertIn('Division Two', resp.get_data(as_text=True))
        self.assertIn('Division Three', resp.get_data(as_text=True))



class TestDivisionDetails(TestLogin):