当前位置: 首页>>代码示例>>Python>>正文


Python models.Event类代码示例

本文整理汇总了Python中sentry.models.Event的典型用法代码示例。如果您正苦于以下问题:Python Event类的具体用法?Python Event怎么用?Python Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Event类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_event

    def create_event(self, event_id=None, **kwargs):
        if event_id is None:
            event_id = uuid4().hex
        if 'group' not in kwargs:
            kwargs['group'] = self.group
        kwargs.setdefault('project', kwargs['group'].project)
        kwargs.setdefault('data', copy.deepcopy(DEFAULT_EVENT_DATA))
        if kwargs.get('tags'):
            tags = kwargs.pop('tags')
            if isinstance(tags, dict):
                tags = tags.items()
            kwargs['data']['tags'] = tags

        kwargs['data'].setdefault('errors', [{
            'type': EventError.INVALID_DATA,
            'name': 'foobar',
        }])

        event = Event(
            event_id=event_id,
            **kwargs
        )
        EventMapping.objects.create(
            project_id=event.project.id,
            event_id=event_id,
            group=event.group,
        )
        # emulate EventManager refs
        event.data.bind_ref(event)
        event.save()
        return event
开发者ID:Akashguharoy,项目名称:sentry,代码行数:31,代码来源:fixtures.py

示例2: test_notify_users_renders_interfaces_with_utf8_fix_issue_422

    def test_notify_users_renders_interfaces_with_utf8_fix_issue_422(self, _send_mail):
        group = Group(
            id=2,
            first_seen=timezone.now(),
            last_seen=timezone.now(),
            project=self.project,
        )

        stacktrace = Mock(spec=Stacktrace)
        stacktrace.to_email_html.return_value = u'רונית מגן'
        stacktrace.get_title.return_value = 'Stacktrace'

        event = Event()
        event.group = group
        event.project = self.project
        event.message = 'Soubor ji\xc5\xbe existuje'
        event.interfaces = {'sentry.interfaces.Stacktrace': stacktrace}

        notification = Notification(event=event)

        with self.options({'system.url-prefix': 'http://example.com'}):
            self.plugin.notify(notification)

        stacktrace.get_title.assert_called_once_with()
        stacktrace.to_email_html.assert_called_once_with(event)
开发者ID:rkeilty,项目名称:sentry,代码行数:25,代码来源:tests.py

示例3: test_notify_users_renders_interfaces_with_utf8

    def test_notify_users_renders_interfaces_with_utf8(self, _send_mail):
        group = Group(
            id=2,
            first_seen=timezone.now(),
            last_seen=timezone.now(),
            project=self.project,
        )

        stacktrace = Mock(spec=Stacktrace)
        stacktrace.to_email_html.return_value = u'רונית מגן'
        stacktrace.get_title.return_value = 'Stacktrace'

        event = Event()
        event.group = group
        event.project = self.project
        event.message = 'hello world'
        event.interfaces = {'sentry.interfaces.Stacktrace': stacktrace}

        notification = Notification(event=event)

        with self.settings(SENTRY_URL_PREFIX='http://example.com'):
            self.plugin.notify(notification)

        stacktrace.get_title.assert_called_once_with()
        stacktrace.to_email_html.assert_called_once_with(event)
开发者ID:Natim,项目名称:sentry,代码行数:25,代码来源:tests.py

示例4: test_stacktrace_wins_over_http

def test_stacktrace_wins_over_http(http_comp_hash, stack_comp_hash):
    # this was a regression, and a very important one
    http_comp_hash.return_value = [['baz']]
    stack_comp_hash.return_value = [['foo', 'bar']]
    event = Event(
        data={
            'stacktrace': {
                'frames': [{
                    'lineno': 1,
                    'filename': 'foo.py',
                }],
            },
            'request': {
                'url': 'http://example.com'
            },
        },
        platform='python',
        message='Foo bar',
    )
    hashes = event.get_hashes()
    assert len(hashes) == 1
    hash_one = hashes[0]
    stack_comp_hash.assert_called_once_with('python')
    assert not http_comp_hash.called
    assert hash_one == md5_from_hash(['foo', 'bar'])
开发者ID:Kayle009,项目名称:sentry,代码行数:25,代码来源:test_get_hashes_from_fingerprint.py

示例5: create_event

    def create_event(self, event_id=None, **kwargs):
        if event_id is None:
            event_id = uuid4().hex
        if 'group' not in kwargs:
            kwargs['group'] = self.group
        kwargs.setdefault('project', kwargs['group'].project)
        kwargs.setdefault('message', kwargs['group'].message)
        kwargs.setdefault('data', LEGACY_DATA.copy())
        if kwargs.get('tags'):
            tags = kwargs.pop('tags')
            if isinstance(tags, dict):
                tags = tags.items()
            kwargs['data']['tags'] = tags

        kwargs['data'].setdefault('errors', [{
            'type': EventError.INVALID_DATA,
            'name': 'foobar',
        }])

        event = Event(
            event_id=event_id,
            **kwargs
        )
        # emulate EventManager refs
        event.data.bind_ref(event)
        event.save()
        return event
开发者ID:JJediny,项目名称:sentry,代码行数:27,代码来源:fixtures.py


注:本文中的sentry.models.Event类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。