# 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()


import datetime as dt
from decimal import Decimal
from itertools import product, cycle
from flask import json
from evesrp import db
from evesrp.models import Request, ActionType
from evesrp.auth import PermissionType
from evesrp.auth.models import Pilot, Division, Permission
from evesrp.util.datetime import utc
from evesrp.util.decimal import PrettyDecimal
from ...util_tests import TestLogin
    attribute = 'status'

    choices = ActionType.statuses


class TestMultipleFilter(TestFilterBase):

    choices = {}

    def test_exact_multiple_filters(self):
        # Compute expected values
        matching_ids = set()
        total_payout = Decimal(0)
        for request in self.killmails:
            for attribute, valid_values in self.choices.items():
                if request.get(attribute) not in valid_values:
                    break
            else:
                matching_ids.add(request['id'])
                if request['status'] != ActionType.rejected:
                    total_payout += request['base_payout']
        # Ask the app what it thinks is the answer
        url = '/request/all/'
        for attribute, values in self.choices.items():
            url += '{}/{}/'.format(attribute, ','.join(values))
        self.check_filter_url(url, matching_ids, total_payout)


class TestDredditCatchFilter(TestMultipleFilter):


# 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/requests/test_filters.py
import datetime as dt
from decimal import Decimal
from itertools import product, cycle
from flask import json
from evesrp import db
from evesrp.models import Request, ActionType
from evesrp.auth import PermissionType
from evesrp.auth.models import Pilot, Division, Permission
from evesrp.util.datetime import utc
from evesrp.util.decimal import PrettyDecimal
from ...util_tests import TestLogin

    attribute = 'status'

    choices = ActionType.statuses


class TestMultipleFilter(TestFilterBase):

    choices = {}

    def test_exact_multiple_filters(self):
        # Compute expected values
        matching_ids = set()
        total_payout = Decimal(0)
        for request in self.killmails:
            for attribute, valid_values in self.choices.items():
                if request.get(attribute) not in valid_values:
                    break
            else:
                matching_ids.add(request['id'])
                if request['status'] != ActionType.rejected:
                    total_payout += request['base_payout']
        # Ask the app what it thinks is the answer
        url = '/request/all/'
        for attribute, values in self.choices.items():
            url += '{}/{}/'.format(attribute, ','.join(values))
        self.check_filter_url(url, matching_ids, total_payout)


class TestDredditCatchFilter(TestMultipleFilter):


    choices = {