@@ -0,0 +1,2700 @@
+# coding: utf-8%0A%0Afrom __future__ import absolute_import%0A%0Aimport os%0Aimport json%0Aimport responses%0A%0Afrom sentry.testutils import TestCase%0Afrom sentry.models import Event%0A%0A%0Adef get_fixture_path(name):%0A    return os.path.join(os.path.dirname(__file__), 'example-project', name)%0A%0A%0Adef load_fixture(name):%0A    with open(get_fixture_path(name)) as f:%0A        return f.read()%0A%0A%0Aclass ExampleTestCase(TestCase):%0A    @responses.activate%0A    def test_sourcemap_expansion(self):%0A        responses.add(%0A            responses.GET,%0A            'http://example.com/test.js',%0A            body=load_fixture('test.js'),%0A            content_type='application/javascript'%0A        )%0A        responses.add(%0A            responses.GET,%0A            'http://example.com/test.min.js',%0A            body=load_fixture('test.min.js'),%0A            content_type='application/javascript'%0A        )%0A        responses.add(%0A            responses.GET,%0A            'http://example.com/test.map',%0A            body=load_fixture('test.map'),%0A            content_type='application/json'%0A        )%0A        responses.add(responses.GET, 'http://example.com/index.html', body='Not Found', status=404)%0A%0A        data = %7B%0A            'message': 'hello',%0A            'platform': 'javascript',%0A            'sentry.interfaces.Exception': %7B%0A                'values': %5B%0A                    %7B%0A                        'type': 'Error',%0A                        'stacktrace': %7B%0A                            'frames': json.loads(load_fixture('minifiedError.json'))%5B::-1%5D,%0A                        %7D,%0A                    %7D%0A                %5D,%0A            %7D%0A        %7D%0A%0A        resp = self._postWithHeader(data)%0A        assert resp.status_code == 200%0A%0A        event = Event.objects.get()%0A%0A        exception = event.interfaces%5B'sentry.interfaces.Exception'%5D%0A        frame_list = exception.values%5B0%5D.stacktrace.frames%0A%0A        assert len(frame_list) == 4%0A%0A        assert frame_list%5B0%5D.function == 'produceStack'%0A        assert frame_list%5B0%5D.lineno == 6%0A        assert frame_list%5B0%5D.filename == 'index.html'%0A%0A        # This function name is obviously wrong but the current logic we%0A        # have does not permit better data here%0A        assert frame_list%5B1%5D.function == 'i'%0A        assert frame_list%5B1%5D.lineno == 20%0A        assert frame_list%5B1%5D.filename == 'test.js'%0A%0A        assert frame_list%5B2%5D.function == 'invoke'%0A        assert frame_list%5B2%5D.lineno == 15%0A        assert frame_list%5B2%5D.filename == 'test.js'%0A%0A        # This function name is obviously wrong but the current logic we%0A        # have does not permit better data here%0A        assert frame_list%5B3%5D.function == 'cb'%0A        assert frame_list%5B3%5D.lineno == 5%0A        assert frame_list%5B3%5D.filename == 'test.js'%0A

Add complete test for javascript sourcemap resolving