# Path: tests_python/util_tests.py
# class TestApp(TestCase):
# 
#     def setUp(self):
#         config = {
#             'SECRET_KEY': 'testing',
#             'SRP_USER_AGENT_EMAIL': 'testing@example.com',
#             'WTF_CSRF_ENABLED': False,
#         }
#         # Default to an ephemeral SQLite DB for testing unless given another
#         # database to connect to.
#         config['SQLALCHEMY_DATABASE_URI'] = env.get('DB', 'sqlite:///')
#         self.app = create_app(config)
#         db.create_all(app=self.app)
# 
#     def tearDown(self):
#         db.drop_all(app=self.app)
# 
# 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()


import datetime as dt
from ..util_tests import TestApp, TestLogin
from evesrp import create_app, db
from evesrp.views import index, request_count
from evesrp.auth import PermissionType
from evesrp.auth.models import User, Division, Permission, Pilot
from evesrp.models import Request, ActionType
            user = self.normal_user
            pilot = Pilot(user, 'A Pilot', 1)
            Permission(d1, PermissionType.submit, user)
            Permission(d2, PermissionType.review, user)
            Permission(d3, PermissionType.pay, user)
            db.session.commit()
            # Populate requests
            request_data = {
                'ship_type': 'Revenant',
                'corporation': 'Center of Applied Studies',
                'kill_timestamp': dt.datetime.utcnow(),
                'system': 'Jita',
                'constellation': 'Kimotoro',
                'region': 'The Forge',
                'pilot_id': 1,
            }
            for division in (d1, d2, d3):
                requests = (
                    # Division 1
                    Request(user, 'Foo', division, request_data.items(),
                        killmail_url='http://google.com',
                        status=ActionType.evaluating),
                    Request(user, 'Foo', division, request_data.items(),
                        killmail_url='http://google.com',
                        status=ActionType.incomplete),
                    Request(user, 'Foo', division, request_data.items(),
                        killmail_url='http://google.com',
                        status=ActionType.approved),
                    Request(user, 'Foo', division, request_data.items(),
                        killmail_url='http://google.com',

# Path: tests_python/util_tests.py
# class TestApp(TestCase):
# 
#     def setUp(self):
#         config = {
#             'SECRET_KEY': 'testing',
#             'SRP_USER_AGENT_EMAIL': 'testing@example.com',
#             'WTF_CSRF_ENABLED': False,
#         }
#         # Default to an ephemeral SQLite DB for testing unless given another
#         # database to connect to.
#         config['SQLALCHEMY_DATABASE_URI'] = env.get('DB', 'sqlite:///')
#         self.app = create_app(config)
#         db.create_all(app=self.app)
# 
#     def tearDown(self):
#         db.drop_all(app=self.app)
# 
# 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_views.py
import datetime as dt
from ..util_tests import TestApp, TestLogin
from evesrp import create_app, db
from evesrp.views import index, request_count
from evesrp.auth import PermissionType
from evesrp.auth.models import User, Division, Permission, Pilot
from evesrp.models import Request, ActionType

            user = self.normal_user
            pilot = Pilot(user, 'A Pilot', 1)
            Permission(d1, PermissionType.submit, user)
            Permission(d2, PermissionType.review, user)
            Permission(d3, PermissionType.pay, user)
            db.session.commit()
            # Populate requests
            request_data = {
                'ship_type': 'Revenant',
                'corporation': 'Center of Applied Studies',
                'kill_timestamp': dt.datetime.utcnow(),
                'system': 'Jita',
                'constellation': 'Kimotoro',
                'region': 'The Forge',
                'pilot_id': 1,
            }
            for division in (d1, d2, d3):
                requests = (
                    # Division 1
                    Request(user, 'Foo', division, request_data.items(),
                        killmail_url='http://google.com',
                        status=ActionType.evaluating),
                    Request(user, 'Foo', division, request_data.items(),
                        killmail_url='http://google.com',
                        status=ActionType.incomplete),
                    Request(user, 'Foo', division, request_data.items(),
                        killmail_url='http://google.com',
                        status=ActionType.approved),
                    Request(user, 'Foo', division, request_data.items(),
                        killmail_url='http://google.com',

                        status=ActionType.paid),