# 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)
# 
# Path: tests_python/test_models.py
# class TestModels(TestLogin):
# 
#     def setUp(self):
#         super(TestModels, self).setUp()
#         with self.app.test_request_context():
#             div = Division('Testing Division')
#             mock_killmail = dict(
#                     id=12842852,
#                     ship_type='Erebus',
#                     corporation='Ever Flow',
#                     alliance='Northern Coalition.',
#                     killmail_url=('http://eve-kill.net/?a=kill_detail'
#                         '&kll_id=12842852'),
#                     base_payout=Decimal(73957900000),
#                     kill_timestamp=dt.datetime(2012, 3, 25, 0, 44, 0,
#                         tzinfo=utc),
#                     system='92D-OI',
#                     constellation='XHYS-O',
#                     region='Venal',
#                     pilot_id=133741,
#             )
#             Pilot(self.normal_user, 'eLusi0n', 133741)
#             Request(self.normal_user, 'Original details', div,
#                     mock_killmail.items())
#             Permission(div, PermissionType.review, self.admin_user)
#             Permission(div, PermissionType.pay, self.admin_user)
#             db.session.commit()
# 
#     @property
#     def request(self):
#         return Request.query.first()
# 
#     def add_action(self, type_):
#         action = Action(self.request, self.admin_user, type_=type_)
#         db.session.commit()
#         return action.id
# 
#     def add_modifier(self, value, absolute=True):
#         if absolute:
#             modifier = AbsoluteModifier(self.request, self.admin_user, None,
#                     Decimal(value))
#         else:
#             modifier = RelativeModifier(self.request, self.admin_user, None,
#                     Decimal(value))
#         db.session.add(modifier)
#         db.session.commit()
#         return modifier.id


from ..util_tests import TestApp
from ..test_models import TestModels
from evesrp import db
from evesrp.models import Request, Modifier, Action, ActionType
from evesrp.auth import PermissionType
from evesrp.auth.models import Entity, User, Group, Permission, Division,\
    PermissionType, APIKey, Note
            u4 = User('User Four', 'AuthMethod', id=4)
            g1 = Group('Group One', 'AuthMethod', id=10)
            g2 = Group('Group Two', 'AuthMethod', id=20)
            db.session.add_all((u1, u2, u3, u4, g1, g2))
            # Users 1 and 2 belong to Groups 1 and 2. User 3 belongs to both,
            # User 4 belongs to no groups
            g1.users.add(u1)
            g2.users.add(u2)
            g1.users.add(u3)
            g2.users.add(u3)
            db.session.commit()

    def test_group_membership(self):
        with self.app.test_request_context():
            self.assertIn(
                    User.query.get(1),
                    Group.query.get(10).users)
            self.assertNotIn(
                    User.query.get(1),
                    Group.query.get(20).users)
            self.assertIn(
                    User.query.get(2),
                    Group.query.get(20).users)
            self.assertNotIn(
                    User.query.get(2),
                    Group.query.get(10).users)
            self.assertIn(
                    User.query.get(3),
                    Group.query.get(10).users)
            self.assertIn(

# 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)
# 
# Path: tests_python/test_models.py
# class TestModels(TestLogin):
# 
#     def setUp(self):
#         super(TestModels, self).setUp()
#         with self.app.test_request_context():
#             div = Division('Testing Division')
#             mock_killmail = dict(
#                     id=12842852,
#                     ship_type='Erebus',
#                     corporation='Ever Flow',
#                     alliance='Northern Coalition.',
#                     killmail_url=('http://eve-kill.net/?a=kill_detail'
#                         '&kll_id=12842852'),
#                     base_payout=Decimal(73957900000),
#                     kill_timestamp=dt.datetime(2012, 3, 25, 0, 44, 0,
#                         tzinfo=utc),
#                     system='92D-OI',
#                     constellation='XHYS-O',
#                     region='Venal',
#                     pilot_id=133741,
#             )
#             Pilot(self.normal_user, 'eLusi0n', 133741)
#             Request(self.normal_user, 'Original details', div,
#                     mock_killmail.items())
#             Permission(div, PermissionType.review, self.admin_user)
#             Permission(div, PermissionType.pay, self.admin_user)
#             db.session.commit()
# 
#     @property
#     def request(self):
#         return Request.query.first()
# 
#     def add_action(self, type_):
#         action = Action(self.request, self.admin_user, type_=type_)
#         db.session.commit()
#         return action.id
# 
#     def add_modifier(self, value, absolute=True):
#         if absolute:
#             modifier = AbsoluteModifier(self.request, self.admin_user, None,
#                     Decimal(value))
#         else:
#             modifier = RelativeModifier(self.request, self.admin_user, None,
#                     Decimal(value))
#         db.session.add(modifier)
#         db.session.commit()
#         return modifier.id


# Path: tests_python/auth/test_models.py
from ..util_tests import TestApp
from ..test_models import TestModels
from evesrp import db
from evesrp.models import Request, Modifier, Action, ActionType
from evesrp.auth import PermissionType
from evesrp.auth.models import Entity, User, Group, Permission, Division,\
    PermissionType, APIKey, Note

            u4 = User('User Four', 'AuthMethod', id=4)
            g1 = Group('Group One', 'AuthMethod', id=10)
            g2 = Group('Group Two', 'AuthMethod', id=20)
            db.session.add_all((u1, u2, u3, u4, g1, g2))
            # Users 1 and 2 belong to Groups 1 and 2. User 3 belongs to both,
            # User 4 belongs to no groups
            g1.users.add(u1)
            g2.users.add(u2)
            g1.users.add(u3)
            g2.users.add(u3)
            db.session.commit()

    def test_group_membership(self):
        with self.app.test_request_context():
            self.assertIn(
                    User.query.get(1),
                    Group.query.get(10).users)
            self.assertNotIn(
                    User.query.get(1),
                    Group.query.get(20).users)
            self.assertIn(
                    User.query.get(2),
                    Group.query.get(20).users)
            self.assertNotIn(
                    User.query.get(2),
                    Group.query.get(10).users)
            self.assertIn(
                    User.query.get(3),
                    Group.query.get(10).users)
            self.assertIn(

                    User.query.get(3),