本文整理汇总了Python中changes.listeners.mail.MailNotificationHandler.get_log_clipping方法的典型用法代码示例。如果您正苦于以下问题:Python MailNotificationHandler.get_log_clipping方法的具体用法?Python MailNotificationHandler.get_log_clipping怎么用?Python MailNotificationHandler.get_log_clipping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类changes.listeners.mail.MailNotificationHandler
的用法示例。
在下文中一共展示了MailNotificationHandler.get_log_clipping方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_simple
# 需要导入模块: from changes.listeners.mail import MailNotificationHandler [as 别名]
# 或者: from changes.listeners.mail.MailNotificationHandler import get_log_clipping [as 别名]
def test_simple(self):
project = self.create_project()
build = self.create_build(project)
job = self.create_job(build)
logsource = LogSource(
project=project,
job=job,
name='console',
)
db.session.add(logsource)
logchunk = LogChunk(
project=project,
job=job,
source=logsource,
offset=0,
size=11,
text='hello\nworld\n',
)
db.session.add(logchunk)
logchunk = LogChunk(
project=project,
job=job,
source=logsource,
offset=11,
size=11,
text='hello\nworld\n',
)
db.session.add(logchunk)
db.session.commit()
handler = MailNotificationHandler()
result = handler.get_log_clipping(logsource, max_size=200, max_lines=3)
assert result == "world\r\nhello\r\nworld"
result = handler.get_log_clipping(logsource, max_size=200, max_lines=1)
assert result == "world"
result = handler.get_log_clipping(logsource, max_size=5, max_lines=3)
assert result == "world"