示例#1
0
 def test_ensure_module_names(self):
     data = {
         'message': 'hello',
         'platform': 'javascript',
         'sentry.interfaces.Exception': {
             'values': [{
                 'type': 'Error',
                 'stacktrace': {
                     'frames': [
                         {
                             'filename': 'foo.js',
                             'lineno': 4,
                             'colno': 0,
                             'function': 'thing',
                         },
                         {
                             'abs_path': 'http://example.com/foo/bar.js',
                             'filename': 'bar.js',
                             'lineno': 1,
                             'colno': 0,
                             'function': 'oops',
                         },
                     ],
                 },
             }],
         }
     }
     processor = SourceProcessor(project=self.project)
     result = processor.process(data)
     exc = result['sentry.interfaces.Exception']['values'][0]
     assert exc['stacktrace']['frames'][1]['module'] == 'foo/bar'
示例#2
0
    def test_get_culprit_is_patched(self):
        data = {
            'message': 'hello',
            'platform': 'javascript',
            'sentry.interfaces.Exception': {
                'values': [{
                    'type': 'Error',
                    'stacktrace': {
                        'frames': [
                            {
                                'abs_path': 'http://example.com/foo.js',
                                'filename': 'foo.js',
                                'lineno': 4,
                                'colno': 0,
                                'function': 'thing',
                            },
                            {
                                'abs_path': 'http://example.com/bar.js',
                                'filename': 'bar.js',
                                'lineno': 1,
                                'colno': 0,
                                'function': 'oops',
                            },
                        ],
                    },
                }],
            }
        }

        processor = SourceProcessor(project=self.project)
        result = processor.process(data)
        assert result['culprit'] == 'bar in oops'
示例#3
0
    def test_get_stacktraces_returns_exception_interface(self):
        data = {
            'message': 'hello',
            'platform': 'javascript',
            'sentry.interfaces.Exception': {
                'values': [{
                    'type': 'Error',
                    'stacktrace': {
                        'frames': [
                            {
                                'abs_path': 'http://example.com/foo.js',
                                'filename': 'foo.js',
                                'lineno': 4,
                                'colno': 0,
                            },
                            {
                                'abs_path': 'http://example.com/foo.js',
                                'filename': 'foo.js',
                                'lineno': 1,
                                'colno': 0,
                            },
                        ],
                    },
                }],
            }
        }

        processor = SourceProcessor(project=self.project)
        result = processor.get_stacktraces(data)
        assert len(result) == 1
        assert type(result[0][1]) is Stacktrace
示例#4
0
 def test_ensure_module_names(self):
     data = {
         'message': 'hello',
         'platform': 'javascript',
         'sentry.interfaces.Exception': {
             'values': [{
                 'type': 'Error',
                 'stacktrace': {
                     'frames': [
                         {
                             'filename': 'foo.js',
                             'lineno': 4,
                             'colno': 0,
                             'function': 'thing',
                         },
                         {
                             'abs_path': 'http://example.com/foo/bar.js',
                             'filename': 'bar.js',
                             'lineno': 1,
                             'colno': 0,
                             'function': 'oops',
                         },
                     ],
                 },
             }],
         }
     }
     processor = SourceProcessor(project=self.project)
     result = processor.process(data)
     exc = result['sentry.interfaces.Exception']['values'][0]
     assert exc['stacktrace']['frames'][1]['module'] == 'foo/bar'
示例#5
0
    def test_get_culprit_is_patched(self):
        data = {
            'message': 'hello',
            'platform': 'javascript',
            'sentry.interfaces.Exception': {
                'values': [{
                    'type': 'Error',
                    'stacktrace': {
                        'frames': [
                            {
                                'abs_path': 'http://example.com/foo.js',
                                'filename': 'foo.js',
                                'lineno': 4,
                                'colno': 0,
                                'function': 'thing',
                            },
                            {
                                'abs_path': 'http://example.com/bar.js',
                                'filename': 'bar.js',
                                'lineno': 1,
                                'colno': 0,
                                'function': 'oops',
                            },
                        ],
                    },
                }],
            }
        }

        processor = SourceProcessor(project=self.project)
        result = processor.process(data)
        assert result['culprit'] == 'bar in oops'
示例#6
0
    def test_get_stacktraces_returns_exception_interface(self):
        data = {
            'message': 'hello',
            'platform': 'javascript',
            'sentry.interfaces.Exception': {
                'values': [{
                    'type': 'Error',
                    'stacktrace': {
                        'frames': [
                            {
                                'abs_path': 'http://example.com/foo.js',
                                'filename': 'foo.js',
                                'lineno': 4,
                                'colno': 0,
                            },
                            {
                                'abs_path': 'http://example.com/foo.js',
                                'filename': 'foo.js',
                                'lineno': 1,
                                'colno': 0,
                            },
                        ],
                    },
                }],
            }
        }

        processor = SourceProcessor(project=self.project)
        result = processor.get_stacktraces(data)
        assert len(result) == 1
        assert type(result[0][1]) is Stacktrace