本文整理汇总了Python中sentry.models.Group类的典型用法代码示例。如果您正苦于以下问题:Python Group类的具体用法?Python Group怎么用?Python Group使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Group类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_notify_users_does_email
def test_notify_users_does_email(self, _send_mail):
project = Project(id=1, name='Project Name')
group = Group()
group.first_seen = timezone.now()
group.last_seen = group.first_seen
group.project = project
group.id = 2
event = Event()
event.group = group
event.message = 'hello world'
event.logger = 'root'
event.project = project
event.date = group.last_seen
with self.Settings(SENTRY_URL_PREFIX='http://example.com'):
p = MailProcessor(send_to=['[email protected]'])
p.notify_users(group, event)
_send_mail.assert_called_once()
args, kwargs = _send_mail.call_args
self.assertEquals(kwargs.get('fail_silently'), False)
self.assertEquals(kwargs.get('project'), project)
self.assertEquals(kwargs.get('subject'), u"[Project Name] ERROR: hello world")
开发者ID:Crowdbooster,项目名称:sentry,代码行数:25,代码来源:tests.py
示例2: test_notify_users_does_email
def test_notify_users_does_email(self, _send_mail):
project = Project(id=1, name="Project Name")
group = Group()
group.first_seen = datetime.datetime.now()
group.last_seen = group.first_seen
group.project = project
group.id = 2
event = Event()
event.group = group
event.message = "hello world"
event.logger = "root"
event.project = project
event.date = group.last_seen
with self.Settings(SENTRY_URL_PREFIX="http://example.com"):
p = MailProcessor(send_to=["[email protected]"])
p.notify_users(group, event)
_send_mail.assert_called_once()
args, kwargs = _send_mail.call_args
self.assertEquals(kwargs.get("fail_silently"), False)
self.assertEquals(kwargs.get("project"), project)
self.assertEquals(kwargs.get("subject"), u"[Project Name] ERROR: hello world")
开发者ID:urbaniak,项目名称:sentry,代码行数:25,代码来源:tests.py
示例3: make_group_generator
def make_group_generator(random, project):
epoch = to_timestamp(datetime(2016, 6, 1, 0, 0, 0, tzinfo=timezone.utc))
for id in itertools.count(1):
first_seen = epoch + random.randint(0, 60 * 60 * 24 * 30)
last_seen = random.randint(first_seen, first_seen + (60 * 60 * 24 * 30))
culprit = make_culprit(random)
level = random.choice(LOG_LEVELS.keys())
message = make_message(random)
group = Group(
id=id,
project=project,
culprit=culprit,
level=level,
message=message,
first_seen=to_datetime(first_seen),
last_seen=to_datetime(last_seen),
status=random.choice((GroupStatus.UNRESOLVED, GroupStatus.RESOLVED, )),
data={
'type': 'default',
'metadata': {
'title': message,
}
}
)
if random.random() < 0.8:
group.data = make_group_metadata(random, group)
yield group
开发者ID:Kayle009,项目名称:sentry,代码行数:31,代码来源:mail.py
示例4: test_get_group_backfill_attributes
def test_get_group_backfill_attributes(self):
now = datetime(2017, 5, 3, 6, 6, 6, tzinfo=pytz.utc)
assert get_group_backfill_attributes(
get_caches(),
Group(
active_at=now,
first_seen=now,
last_seen=now,
platform='javascript',
message='Hello from JavaScript',
level=logging.INFO,
score=Group.calculate_score(3, now),
logger='javascript',
times_seen=1,
first_release=None,
culprit='',
data={
'type': 'default',
'last_received': to_timestamp(now),
'metadata': {},
},
),
[
Event(
platform='python',
message='Hello from Python',
datetime=now - timedelta(hours=1),
data={
'type': 'default',
'metadata': {},
'tags': [
['level', 'error'],
['logger', 'python'],
],
},
),
Event(
platform='java',
message='Hello from Java',
datetime=now - timedelta(hours=2),
data={
'type': 'default',
'metadata': {},
'tags': [
['level', 'debug'],
['logger', 'java'],
],
},
),
],
) == {
'active_at': now - timedelta(hours=2),
'first_seen': now - timedelta(hours=2),
'platform': 'java',
'score': Group.calculate_score(3, now),
'logger': 'java',
'times_seen': 3,
'first_release': None,
}
开发者ID:Kayle009,项目名称:sentry,代码行数:59,代码来源:test_unmerge.py
示例5: new_note
def new_note(request):
org = Organization(
id=1,
slug='example',
name='Example',
)
team = Team(
id=1,
slug='example',
name='Example',
organization=org,
)
project = Project(
id=1,
slug='example',
name='Example',
team=team,
organization=org,
)
group = Group(
id=1,
project=project,
message='This is an example event.',
)
event = Event(
id=1,
project=project,
group=group,
message=group.message,
data=load_data('python'),
)
note = Activity(
group=event.group, event=event, project=event.project,
type=Activity.NOTE, user=request.user,
data={'text': 'This is an example note!'},
)
preview = MailPreview(
html_template='sentry/emails/activity/note.html',
text_template='sentry/emails/activity/note.txt',
context={
'data': note.data,
'author': note.user,
'date': note.datetime,
'group': group,
'link': group.get_absolute_url(),
},
)
return render_to_response('sentry/debug/mail/preview.html', {
'preview': preview,
})
开发者ID:carriercomm,项目名称:sentry-1,代码行数:52,代码来源:mail.py
示例6: assigned
def assigned(request):
org = Organization(
id=1,
slug='example',
name='Example',
)
team = Team(
id=1,
slug='example',
name='Example',
organization=org,
)
project = Project(
id=1,
slug='example',
name='Example',
team=team,
organization=org,
)
group = Group(
id=1,
project=project,
message='This is an example event.',
)
event = Event(
id=1,
project=project,
group=group,
message=group.message,
data=load_data('python'),
)
assigned = Activity(
group=event.group, event=event, project=event.project,
type=Activity.ASSIGNED, user=request.user,
data={'text': 'This is an example note!'},
)
return MailPreview(
html_template='sentry/emails/activity/assigned.html',
text_template='sentry/emails/activity/assigned.txt',
context={
'data': assigned.data,
'author': assigned.user,
'date': assigned.datetime,
'group': group,
'link': group.get_absolute_url(),
},
).render()
开发者ID:280185386,项目名称:sentry,代码行数:49,代码来源:mail.py
示例7: get
def get(self, request, share_id):
"""
Retrieve an aggregate
Return details on an individual aggregate specified by it's shared ID.
{method} {path}
Note: This is not the equivilant of what you'd receive with the standard
group details endpoint. Data is more restrictive and designed
specifically for sharing.
"""
try:
group = Group.from_share_id(share_id)
except Group.DoesNotExist:
raise ResourceDoesNotExist
if group.organization.flags.disable_shared_issues:
raise ResourceDoesNotExist
event = group.get_latest_event()
context = serialize(group, request.user, SharedGroupSerializer())
context['latestEvent'] = serialize(event, request.user, SharedEventSerializer())
# TODO(dcramer): use specific serializer for public group and embed
# event details as part of api response
return Response(context)
开发者ID:IthacaDream,项目名称:sentry,代码行数:29,代码来源:shared_group_details.py
示例8: make_group_generator
def make_group_generator(random, project):
epoch = to_timestamp(datetime(2016, 6, 1, 0, 0, 0, tzinfo=timezone.utc))
for id in itertools.count(1):
first_seen = epoch + random.randint(0, 60 * 60 * 24 * 30)
last_seen = random.randint(first_seen, first_seen + (60 * 60 * 24 * 30))
group = Group(
id=id,
project=project,
culprit=make_culprit(random),
level=random.choice(LOG_LEVELS.keys()),
message=make_message(random),
first_seen=to_datetime(first_seen),
last_seen=to_datetime(last_seen),
)
if random.random() < 0.8:
group.data = make_group_metadata(random, group)
yield group
开发者ID:davgit,项目名称:sentry,代码行数:20,代码来源:mail.py
示例9: test_notify_users_renders_interfaces_with_utf8
def test_notify_users_renders_interfaces_with_utf8(self, _send_mail):
group = Group()
group.first_seen = timezone.now()
group.last_seen = group.first_seen
group.id = 2
group.project_id = 1
stacktrace = Mock(spec=Stacktrace)
stacktrace.to_string.return_value = u'רונית מגן'
stacktrace.get_title.return_value = 'Stacktrace'
event = Event()
event.group = group
event.message = 'hello world'
event.logger = 'root'
event.site = None
event.interfaces = {'sentry.interfaces.Stacktrace': stacktrace}
with self.Settings(SENTRY_URL_PREFIX='http://example.com'):
p = MailProcessor(send_to=['[email protected]'])
p.notify_users(group, event)
stacktrace.get_title.assert_called_once_with()
stacktrace.to_string.assert_called_once_with(event)
开发者ID:Crowdbooster,项目名称:sentry,代码行数:24,代码来源:tests.py
示例10: test_notify_users_renders_interfaces
def test_notify_users_renders_interfaces(self, _send_mail):
group = Group()
group.first_seen = datetime.datetime.now()
group.last_seen = group.first_seen
group.id = 2
group.project_id = 1
stacktrace = Mock(spec=Stacktrace)
stacktrace.to_string.return_value = "foo bar"
stacktrace.get_title.return_value = "Stacktrace"
event = Event()
event.group = group
event.message = "hello world"
event.logger = "root"
event.site = None
event.interfaces = {"sentry.interfaces.Stacktrace": stacktrace}
with self.Settings(SENTRY_URL_PREFIX="http://example.com"):
p = MailProcessor(send_to=["[email protected]"])
p.notify_users(group, event)
stacktrace.get_title.assert_called_once_with()
stacktrace.to_string.assert_called_once_with(event)
开发者ID:urbaniak,项目名称:sentry,代码行数:24,代码来源:tests.py
示例11: get
def get(self, request):
"""
Retrieve an aggregate
Return details on an individual aggregate specified by query parameters.
{method} {path}?shareId=mnIX
"""
share_id = request.GET.get('shareId')
if share_id:
try:
group = Group.from_share_id(share_id)
except Group.DoesNotExist:
group = None
else:
group = None
if not group:
return Response({'detail': 'No groups found'}, status=404)
return client.get('/groups/{}/'.format(group.id), request.user, request.auth)
开发者ID:carriercomm,项目名称:sentry-1,代码行数:22,代码来源:group_index.py
示例12: test_get_group_creation_attributes
def test_get_group_creation_attributes(self):
now = datetime(2017, 5, 3, 6, 6, 6, tzinfo=pytz.utc)
events = [
Event(
platform='javascript',
message='Hello from JavaScript',
datetime=now,
data={
'type': 'default',
'metadata': {},
'tags': [
['level', 'info'],
['logger', 'javascript'],
],
},
),
Event(
platform='python',
message='Hello from Python',
datetime=now - timedelta(hours=1),
data={
'type': 'default',
'metadata': {},
'tags': [
['level', 'error'],
['logger', 'python'],
],
},
),
Event(
platform='java',
message='Hello from Java',
datetime=now - timedelta(hours=2),
data={
'type': 'default',
'metadata': {},
'tags': [
['level', 'debug'],
['logger', 'java'],
],
},
),
]
assert get_group_creation_attributes(
get_caches(),
events,
) == {
'active_at': now - timedelta(hours=2),
'first_seen': now - timedelta(hours=2),
'last_seen': now,
'platform': 'java',
'message': 'Hello from JavaScript',
'level': logging.INFO,
'score': Group.calculate_score(3, now),
'logger': 'java',
'times_seen': 3,
'first_release': None,
'culprit': '',
'data': {
'type': 'default',
'last_received': to_timestamp(now),
'metadata': {},
},
}
开发者ID:Kayle009,项目名称:sentry,代码行数:65,代码来源:test_unmerge.py
示例13: test_invalid_shared_id
def test_invalid_shared_id(self):
with pytest.raises(Group.DoesNotExist):
Group.from_share_id('adc7a5b902184ce3818046302e94f8ec')
开发者ID:yaoqi,项目名称:sentry,代码行数:3,代码来源:test_group.py
示例14: get_group_creation_attributes
'times_seen': lambda event: 0,
}
backfill_fields = {
'platform': lambda caches, data, event: event.platform,
'logger': lambda caches, data, event: event.get_tag('logger') or DEFAULT_LOGGER_NAME,
'first_seen': lambda caches, data, event: event.datetime,
'active_at': lambda caches, data, event: event.datetime,
'first_release': lambda caches, data, event: caches['Release'](
caches['Project'](event.project_id).organization_id,
event.get_tag('sentry:release'),
) if event.get_tag('sentry:release') else data.get('first_release', None),
'times_seen': lambda caches, data, event: data['times_seen'] + 1,
'score': lambda caches, data, event: Group.calculate_score(
data['times_seen'] + 1,
data['last_seen'],
),
}
def get_group_creation_attributes(caches, events):
latest_event = events[0]
return reduce(
lambda data, event: merge_mappings([
data,
{name: f(caches, data, event) for name, f in backfill_fields.items()},
]),
events,
{name: f(latest_event) for name, f in initial_fields.items()},
)
开发者ID:Kayle009,项目名称:sentry,代码行数:31,代码来源:unmerge.py
注:本文中的sentry.models.Group类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论