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


Python Ticket.modify_comment方法代码示例

本文整理汇总了Python中trac.ticket.model.Ticket.modify_comment方法的典型用法代码示例。如果您正苦于以下问题:Python Ticket.modify_comment方法的具体用法?Python Ticket.modify_comment怎么用?Python Ticket.modify_comment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在trac.ticket.model.Ticket的用法示例。


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

示例1: test_modify_missing_cnums_and_comment

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import modify_comment [as 别名]
    def test_modify_missing_cnums_and_comment(self):
        """Editing a comments when all cnums are missing and one comment
        field is missing
        """
        cursor = self.db.cursor()
        cursor.execute("UPDATE ticket_change SET oldvalue='' "
                       "WHERE oldvalue='1'")
        cursor.execute("DELETE FROM ticket_change "
                       "WHERE field='comment' AND oldvalue='1.2'")
        cursor.execute("UPDATE ticket_change SET oldvalue='' "
                       "WHERE oldvalue='3'")
        self.db.commit()

        # Modify after missing comment
        ticket = Ticket(self.env, self.id)
        t = self.created + timedelta(seconds=50)
        ticket.modify_comment(self._find_change(ticket, 3),
                              'joe', 'New comment 3', t)
        self.assertChange(ticket, 3, self.t3, 'jim',
            keywords=dict(author='jim', old='a, b, c', new='a, b'),
            comment=dict(author='jim', old='', new='New comment 3'),
            _comment0=dict(author='joe', old='Comment 3',
                           new=str(to_utimestamp(t))))

        # Modify missing comment
        t = self.created + timedelta(seconds=60)
        ticket.modify_comment(self._find_change(ticket, 2),
                              'joe', 'New comment 2', t)
        self.assertChange(ticket, 2, self.t2, 'john',
            owner=dict(author='john', old='john', new='jack'),
            comment=dict(author='john', old='', new='New comment 2'),
            _comment0=dict(author='joe', old='',
                           new=str(to_utimestamp(t))))
开发者ID:zjj,项目名称:trac_hack,代码行数:35,代码来源:model.py

示例2: test_modify_comment

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import modify_comment [as 别名]
    def test_modify_comment(self):
        """Check modification of a "standalone" comment"""
        ticket = Ticket(self.env, self.id)
        self.assertChange(ticket, 1, self.t1, "jack", comment=dict(author="jack", old="1", new="Comment 1"))
        self.assertChange(
            ticket,
            2,
            self.t2,
            "john",
            owner=dict(author="john", old="john", new="jack"),
            comment=dict(author="john", old="1.2", new="Comment 2"),
        )
        self.assertChange(
            ticket,
            3,
            self.t3,
            "jim",
            keywords=dict(author="jim", old="a, b, c", new="a, b"),
            comment=dict(author="jim", old="3", new="Comment 3"),
        )

        t = self.created + timedelta(seconds=10)
        ticket.modify_comment(self._find_change(ticket, 1), "joe", "New comment 1", t)
        self.assertChange(
            ticket,
            1,
            self.t1,
            "jack",
            comment=dict(author="jack", old="1", new="New comment 1"),
            _comment0=dict(author="joe", old="Comment 1", new=str(to_utimestamp(t))),
        )
开发者ID:wiraqutra,项目名称:photrackjp,代码行数:33,代码来源:model.py

示例3: test_threading

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import modify_comment [as 别名]
 def test_threading(self):
     """Check modification of a "threaded" comment"""
     ticket = Ticket(self.env, self.id)
     t = self.created + timedelta(seconds=20)
     ticket.modify_comment(self._find_change(ticket, 2),
                           'joe', 'New comment 2', t)
     self.assertChange(ticket, 2, self.t2, 'john',
         owner=dict(author='john', old='john', new='jack'),
         comment=dict(author='john', old='1.2', new='New comment 2'),
         _comment0=dict(author='joe', old='Comment 2',
                        new=str(to_utimestamp(t))))
开发者ID:zjj,项目名称:trac_hack,代码行数:13,代码来源:model.py

示例4: test_comment_history

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import modify_comment [as 别名]
 def test_comment_history(self):
     """Check the generation of the comment history"""
     ticket = Ticket(self.env, self.id)
     t = [self.t1]
     for i in range(1, 32):
         t.append(self.created + timedelta(minutes=i))
         ticket.modify_comment(self._find_change(ticket, 1), "joe (%d)" % i, "Comment 1 (%d)" % i, t[-1])
     history = ticket.get_comment_history(1)
     self.assertEqual((0, t[0], "jack", "Comment 1"), history[0])
     for i in range(1, len(history)):
         self.assertEqual((i, t[i], "joe (%d)" % i, "Comment 1 (%d)" % i), history[i])
开发者ID:wiraqutra,项目名称:photrackjp,代码行数:13,代码来源:model.py

示例5: test_modify_missing_cnum

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import modify_comment [as 别名]
 def test_modify_missing_cnum(self):
     """Editing a comment with no cnum in oldvalue"""
     self.env.db_transaction(
         "UPDATE ticket_change SET oldvalue='' WHERE oldvalue='3'")
     ticket = Ticket(self.env, self.id)
     t = self.created + timedelta(seconds=30)
     ticket.modify_comment(self._find_change(ticket, 3),
                           'joe', 'New comment 3', t)
     self.assertChange(ticket, 3, self.t3, 'jim',
         keywords=dict(author='jim', old='a, b, c', new='a, b'),
         comment=dict(author='jim', old='', new='New comment 3'),
         _comment0=dict(author='joe', old='Comment 3',
                        new=str(to_utimestamp(t))))
开发者ID:thimalk,项目名称:bloodhound,代码行数:15,代码来源:model.py

示例6: test_modify_missing_comment

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import modify_comment [as 别名]
 def test_modify_missing_comment(self):
     """Editing a comment where the comment field is missing"""
     self.env.db_transaction("""
         DELETE FROM ticket_change WHERE field='comment' AND oldvalue='1.2'
         """)
     ticket = Ticket(self.env, self.id)
     t = self.created + timedelta(seconds=40)
     ticket.modify_comment(self._find_change(ticket, 2),
                           'joe', 'New comment 2', t)
     self.assertChange(ticket, 2, self.t2, 'john',
         owner=dict(author='john', old='john', new='jack'),
         comment=dict(author='john', old='', new='New comment 2'),
         _comment0=dict(author='joe', old='',
                        new=str(to_utimestamp(t))))
开发者ID:thimalk,项目名称:bloodhound,代码行数:16,代码来源:model.py

示例7: test_threading

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import modify_comment [as 别名]
 def test_threading(self):
     """Check modification of a "threaded" comment"""
     ticket = Ticket(self.env, self.id)
     t = self.created + timedelta(seconds=20)
     ticket.modify_comment(self._find_change(ticket, 2), "joe", "New comment 2", t)
     self.assertChange(
         ticket,
         2,
         self.t2,
         "john",
         owner=dict(author="john", old="john", new="jack"),
         comment=dict(author="john", old="1.2", new="New comment 2"),
         _comment0=dict(author="joe", old="Comment 2", new=str(to_utimestamp(t))),
     )
开发者ID:wiraqutra,项目名称:photrackjp,代码行数:16,代码来源:model.py

示例8: test_modify_missing_comment

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import modify_comment [as 别名]
    def test_modify_missing_comment(self):
        """Editing a comment where the comment field is missing"""
        cursor = self.db.cursor()
        cursor.execute("DELETE FROM ticket_change " "WHERE field='comment' AND oldvalue='1.2'")
        self.db.commit()

        ticket = Ticket(self.env, self.id)
        t = self.created + timedelta(seconds=40)
        ticket.modify_comment(self._find_change(ticket, 2), "joe", "New comment 2", t)
        self.assertChange(
            ticket,
            2,
            self.t2,
            "john",
            owner=dict(author="john", old="john", new="jack"),
            comment=dict(author="john", old="", new="New comment 2"),
            _comment0=dict(author="joe", old="", new=str(to_utimestamp(t))),
        )
开发者ID:wiraqutra,项目名称:photrackjp,代码行数:20,代码来源:model.py

示例9: test_modify_missing_cnum

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import modify_comment [as 别名]
    def test_modify_missing_cnum(self):
        """Editing a comment with no cnum in oldvalue"""
        cursor = self.db.cursor()
        cursor.execute("UPDATE ticket_change SET oldvalue='' " "WHERE oldvalue='3'")
        self.db.commit()

        ticket = Ticket(self.env, self.id)
        t = self.created + timedelta(seconds=30)
        ticket.modify_comment(self._find_change(ticket, 3), "joe", "New comment 3", t)
        self.assertChange(
            ticket,
            3,
            self.t3,
            "jim",
            keywords=dict(author="jim", old="a, b, c", new="a, b"),
            comment=dict(author="jim", old="", new="New comment 3"),
            _comment0=dict(author="joe", old="Comment 3", new=str(to_utimestamp(t))),
        )
开发者ID:wiraqutra,项目名称:photrackjp,代码行数:20,代码来源:model.py

示例10: test_modify_comment

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import modify_comment [as 别名]
 def test_modify_comment(self):
     """Check modification of a "standalone" comment"""
     ticket = Ticket(self.env, self.id)
     self.assertChange(ticket, 1, self.t1, 'jack',
         comment=dict(author='jack', old='1', new='Comment 1'))
     self.assertChange(ticket, 2, self.t2, 'john',
         owner=dict(author='john', old='john', new='jack'),
         comment=dict(author='john', old='1.2', new='Comment 2'))
     self.assertChange(ticket, 3, self.t3, 'jim',
         keywords=dict(author='jim', old='a, b, c', new='a, b'),
         comment=dict(author='jim', old='3', new='Comment 3'))
     
     t = self.created + timedelta(seconds=10)
     ticket.modify_comment(self._find_change(ticket, 1),
                           'joe', 'New comment 1', t)
     self.assertChange(ticket, 1, self.t1, 'jack',
         comment=dict(author='jack', old='1', new='New comment 1'),
         _comment0=dict(author='joe', old='Comment 1',
                        new=str(to_utimestamp(t))))
开发者ID:zjj,项目名称:trac_hack,代码行数:21,代码来源:model.py

示例11: test_missing_comment_edit

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import modify_comment [as 别名]
    def test_missing_comment_edit(self):
        """Modify a comment where one edit is missing"""
        ticket = Ticket(self.env, self.id)
        t1 = self.created + timedelta(seconds=70)
        ticket.modify_comment(self._find_change(ticket, 1),
                              'joe', 'New comment 1', t1)
        t2 = self.created + timedelta(seconds=80)
        ticket.modify_comment(self._find_change(ticket, 1),
                              'joe', 'Other comment 1', t2)

        self.assertChange(ticket, 1, self.t1, 'jack',
            comment=dict(author='jack', old='1', new='Other comment 1'),
            _comment0=dict(author='joe', old='Comment 1',
                           new=str(to_utimestamp(t1))),
            _comment1=dict(author='joe', old='New comment 1',
                           new=str(to_utimestamp(t2))))
        
        cursor = self.db.cursor()
        cursor.execute("DELETE FROM ticket_change "
                       "WHERE field='_comment0'")
        self.db.commit()

        t3 = self.created + timedelta(seconds=90)
        ticket.modify_comment(self._find_change(ticket, 1),
                              'joe', 'Newest comment 1', t3)
        
        self.assertChange(ticket, 1, self.t1, 'jack',
            comment=dict(author='jack', old='1', new='Newest comment 1'),
            _comment1=dict(author='joe', old='New comment 1',
                           new=str(to_utimestamp(t2))),
            _comment2=dict(author='joe', old='Other comment 1',
                           new=str(to_utimestamp(t3))))
开发者ID:zjj,项目名称:trac_hack,代码行数:34,代码来源:model.py


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