# Path: tests_python/util_tests.py
# class TestApp(TestCase):
# class NullAuthForm(Form):
# class NullAuth(AuthMethod):
# class TestLogin(TestApp):
#     def setUp(self):
#     def tearDown(self):
#     def login(self, form):
#     def view(self):
#     def form(self):
#     def setUp(self):
#     def login(self, username=None):
#     def normal_user(self):
#     def admin_user(self):
# def response(*args, **kwargs):
# def paxswill_zkillboard(url, request):
# def no_alliance_zkillboard(url, request):
# def foxfour_esi(url, request):
# 
# Path: tests_python/test_systems.py
# @urlmatch(scheme='https',
#           netloc=r'(public-)?crest(-tq)?\.eveonline\.com',
#           path=r'^/solarsystems/(999)?30000142/$')
# def jita_lookup(url, request):
#     resp = {
#         'name': 'Jita',
#         # The "internal" crest links aren't prefixed, as those are used for
#         # system->constellation and constellation->region lookups
#         'constellation': {
#             'href':
#                 'https://crest-tq.eveonline.com/constellations/20000020/',
#             'id': 20000020,
#             'id_str': '20000020' 
#         },
#         'id_str': '30000142',
#         'id': 30000142 
#     }
#     return response(content=json.dumps(resp))
# 
# @urlmatch(scheme='https',
#           netloc=r'(public-)?crest(-tq)?\.eveonline\.com',
#           path=r'^/constellations/(999)?20000020/$')
# def kimotoro_lookup(url, request):
#     resp = {
#         'name': 'Kimotoro',
#         'region': {'href':
#             'https://crest-tq.eveonline.com/regions/10000002/'},
#     }
#     return response(content=json.dumps(resp))
# 
# @urlmatch(scheme='https',
#           netloc=r'(public-)?crest(-tq)?\.eveonline\.com',
#           path=r'^/regions/(999)?10000002/$')
# def forge_lookup(url, request):
#     resp = {
#         'name': 'The Forge',
#         'id': 10000002,
#         'id_str': '10000002',
#     }
#     return response(content=json.dumps(resp))


from unittest import TestCase
from decimal import Decimal
from httmock import HTTMock, all_requests, urlmatch
from evesrp import killmail
from .util_tests import TestApp, all_mocks, response
from .test_systems import jita_lookup, kimotoro_lookup, forge_lookup
import json

        with HTTMock(legacy_no_alliance_response):
            # Actual testing
            km = killmail.LegacyZKillmail(
                'https://zkillboard.com/kill/38862043/')
            expected_values = {
                u'pilot': u'Dave Duclas',
                u'ship': u'Breacher',
                u'corp': u'Omega LLC',
                u'alliance': None,
                u'system': u'Onatoh',
                u'domain': u'zkillboard.com',
                u'value': Decimal('10432408.70'),
            }
            for attr, value in expected_values.items():
                self.assertEqual(getattr(km, attr), value,
                        msg=u'{} is not {}'.format(attr, value))

    def test_invalid_zkb_url(self):
        with self.assertRaisesRegexp(ValueError,
                u"'.*' is not a valid zKillboard killmail"):
            killmail.LegacyZKillmail('foobar')

    def test_invalid_zkb_response(self):
        @all_requests
        def bad_response(url, request):
            return response(status_code=403, content=u'')

        with HTTMock(bad_response):
            url = 'https://zkillboard.com/kill/38862043/'

# Path: tests_python/util_tests.py
# class TestApp(TestCase):
# class NullAuthForm(Form):
# class NullAuth(AuthMethod):
# class TestLogin(TestApp):
#     def setUp(self):
#     def tearDown(self):
#     def login(self, form):
#     def view(self):
#     def form(self):
#     def setUp(self):
#     def login(self, username=None):
#     def normal_user(self):
#     def admin_user(self):
# def response(*args, **kwargs):
# def paxswill_zkillboard(url, request):
# def no_alliance_zkillboard(url, request):
# def foxfour_esi(url, request):
# 
# Path: tests_python/test_systems.py
# @urlmatch(scheme='https',
#           netloc=r'(public-)?crest(-tq)?\.eveonline\.com',
#           path=r'^/solarsystems/(999)?30000142/$')
# def jita_lookup(url, request):
#     resp = {
#         'name': 'Jita',
#         # The "internal" crest links aren't prefixed, as those are used for
#         # system->constellation and constellation->region lookups
#         'constellation': {
#             'href':
#                 'https://crest-tq.eveonline.com/constellations/20000020/',
#             'id': 20000020,
#             'id_str': '20000020' 
#         },
#         'id_str': '30000142',
#         'id': 30000142 
#     }
#     return response(content=json.dumps(resp))
# 
# @urlmatch(scheme='https',
#           netloc=r'(public-)?crest(-tq)?\.eveonline\.com',
#           path=r'^/constellations/(999)?20000020/$')
# def kimotoro_lookup(url, request):
#     resp = {
#         'name': 'Kimotoro',
#         'region': {'href':
#             'https://crest-tq.eveonline.com/regions/10000002/'},
#     }
#     return response(content=json.dumps(resp))
# 
# @urlmatch(scheme='https',
#           netloc=r'(public-)?crest(-tq)?\.eveonline\.com',
#           path=r'^/regions/(999)?10000002/$')
# def forge_lookup(url, request):
#     resp = {
#         'name': 'The Forge',
#         'id': 10000002,
#         'id_str': '10000002',
#     }
#     return response(content=json.dumps(resp))


# Path: tests_python/test_killmail.py
from unittest import TestCase
from decimal import Decimal
from httmock import HTTMock, all_requests, urlmatch
from evesrp import killmail
from .util_tests import TestApp, all_mocks, response
from .test_systems import jita_lookup, kimotoro_lookup, forge_lookup
import json


        with HTTMock(legacy_no_alliance_response):
            # Actual testing
            km = killmail.LegacyZKillmail(
                'https://zkillboard.com/kill/38862043/')
            expected_values = {
                u'pilot': u'Dave Duclas',
                u'ship': u'Breacher',
                u'corp': u'Omega LLC',
                u'alliance': None,
                u'system': u'Onatoh',
                u'domain': u'zkillboard.com',
                u'value': Decimal('10432408.70'),
            }
            for attr, value in expected_values.items():
                self.assertEqual(getattr(km, attr), value,
                        msg=u'{} is not {}'.format(attr, value))

    def test_invalid_zkb_url(self):
        with self.assertRaisesRegexp(ValueError,
                u"'.*' is not a valid zKillboard killmail"):
            killmail.LegacyZKillmail('foobar')

    def test_invalid_zkb_response(self):
        @all_requests
        def bad_response(url, request):
            return response(status_code=403, content=u'')

        with HTTMock(bad_response):
            url = 'https://zkillboard.com/kill/38862043/'

            with self.assertRaisesRegexp(LookupError,