本文整理汇总了Python中trac.wiki.WikiPage.delete方法的典型用法代码示例。如果您正苦于以下问题:Python WikiPage.delete方法的具体用法?Python WikiPage.delete怎么用?Python WikiPage.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.wiki.WikiPage
的用法示例。
在下文中一共展示了WikiPage.delete方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_can_index_version_deleted_event
# 需要导入模块: from trac.wiki import WikiPage [as 别名]
# 或者: from trac.wiki.WikiPage import delete [as 别名]
def test_can_index_version_deleted_event(self):
#arrange
self.insert_wiki(self.DUMMY_PAGE_NAME, "version1")
page = WikiPage(self.env, self.DUMMY_PAGE_NAME)
page.text = "version 2"
page.save("anAuthor", "some comment", "::1")
page.delete(version=2)
#act
results = self.search_api.query("*:*")
#assert
self.print_result(results)
self.assertEqual(1, results.hits)
self.assertEqual("version1", results.docs[0]["content"])
示例2: test_delete_page_last_version
# 需要导入模块: from trac.wiki import WikiPage [as 别名]
# 或者: from trac.wiki.WikiPage import delete [as 别名]
def test_delete_page_last_version(self):
self.env.db_transaction(
"INSERT INTO wiki VALUES(%s,%s,%s,%s,%s,%s,%s,%s)",
('TestPage', 1, 42, 'joe', '::1', 'Bla bla', 'Testing', 0))
page = WikiPage(self.env, 'TestPage')
page.delete(version=1)
self.assertFalse(page.exists)
self.assertEqual([], self.env.db_query("""
SELECT version, time, author, ipnr, text, comment, readonly
FROM wiki WHERE name=%s
""", ('TestPage',)))
listener = TestWikiChangeListener(self.env)
self.assertEqual(page, listener.deleted[0])
示例3: test_delete_page_last_version
# 需要导入模块: from trac.wiki import WikiPage [as 别名]
# 或者: from trac.wiki.WikiPage import delete [as 别名]
def test_delete_page_last_version(self):
cursor = self.db.cursor()
cursor.execute("INSERT INTO wiki VALUES(%s,%s,%s,%s,%s,%s,%s,%s)",
('TestPage', 1, 42, 'joe', '::1', 'Bla bla', 'Testing',
0))
page = WikiPage(self.env, 'TestPage')
page.delete(version=1)
self.assertEqual(False, page.exists)
cursor.execute("SELECT version,time,author,ipnr,text,comment,"
"readonly FROM wiki WHERE name=%s", ('TestPage',))
self.assertEqual(None, cursor.fetchone())
listener = TestWikiChangeListener(self.env)
self.assertEqual(page, listener.deleted[0])
示例4: test_delete_page_version
# 需要导入模块: from trac.wiki import WikiPage [as 别名]
# 或者: from trac.wiki.WikiPage import delete [as 别名]
def test_delete_page_version(self):
self.env.db_transaction.executemany(
"INSERT INTO wiki VALUES(%s,%s,%s,%s,%s,%s,%s,%s)",
[('TestPage', 1, 42, 'joe', '::1', 'Bla bla', 'Testing', 0),
('TestPage', 2, 43, 'kate', '192.168.0.11', 'Bla', 'Changing', 0)])
page = WikiPage(self.env, 'TestPage')
page.delete(version=2)
self.assertTrue(page.exists)
self.assertEqual(
[(1, 42, 'joe', '::1', 'Bla bla', 'Testing', 0)],
self.env.db_query("""
SELECT version, time, author, ipnr, text, comment, readonly
FROM wiki WHERE name=%s
""", ('TestPage',)))
listener = TestWikiChangeListener(self.env)
self.assertEqual(page, listener.deleted_version[0])
示例5: test_delete_page
# 需要导入模块: from trac.wiki import WikiPage [as 别名]
# 或者: from trac.wiki.WikiPage import delete [as 别名]
def test_delete_page(self):
cursor = self.db.cursor()
cursor.execute(
"INSERT INTO wiki VALUES(%s,%s,%s,%s,%s,%s,%s,%s)",
("TestPage", 1, 42, "joe", "::1", "Bla bla", "Testing", 0),
)
page = WikiPage(self.env, "TestPage")
page.delete()
self.assertEqual(False, page.exists)
cursor.execute(
"SELECT version,time,author,ipnr,text,comment," "readonly FROM wiki WHERE name=%s", ("TestPage",)
)
self.assertEqual(None, cursor.fetchone())
listener = TestWikiChangeListener(self.env)
self.assertEqual(page, listener.deleted[0])
示例6: test_delete_page_version
# 需要导入模块: from trac.wiki import WikiPage [as 别名]
# 或者: from trac.wiki.WikiPage import delete [as 别名]
def test_delete_page_version(self):
cursor = self.db.cursor()
cursor.executemany("INSERT INTO wiki VALUES(%s,%s,%s,%s,%s,%s,%s,%s)",
[('TestPage', 1, 42, 'joe', '::1', 'Bla bla',
'Testing', 0),
('TestPage', 2, 43, 'kate', '192.168.0.101', 'Bla',
'Changing', 0)])
page = WikiPage(self.env, 'TestPage')
page.delete(version=2)
self.assertEqual(True, page.exists)
cursor.execute("SELECT version,time,author,ipnr,text,comment,"
"readonly FROM wiki WHERE name=%s", ('TestPage',))
self.assertEqual((1, 42, 'joe', '::1', 'Bla bla', 'Testing', 0),
cursor.fetchone())
self.assertEqual(None, cursor.fetchone())
listener = TestWikiChangeListener(self.env)
self.assertEqual(page, listener.deleted_version[0])
示例7: test_delete_page_version
# 需要导入模块: from trac.wiki import WikiPage [as 别名]
# 或者: from trac.wiki.WikiPage import delete [as 别名]
def test_delete_page_version(self):
cursor = self.db.cursor()
cursor.executemany(
"INSERT INTO wiki VALUES(%s,%s,%s,%s,%s,%s,%s,%s)",
[
("TestPage", 1, 42, "joe", "::1", "Bla bla", "Testing", 0),
("TestPage", 2, 43, "kate", "192.168.0.101", "Bla", "Changing", 0),
],
)
page = WikiPage(self.env, "TestPage")
page.delete(version=2)
self.assertEqual(True, page.exists)
cursor.execute(
"SELECT version,time,author,ipnr,text,comment," "readonly FROM wiki WHERE name=%s", ("TestPage",)
)
self.assertEqual((1, 42, "joe", "::1", "Bla bla", "Testing", 0), cursor.fetchone())
self.assertEqual(None, cursor.fetchone())
listener = TestWikiChangeListener(self.env)
self.assertEqual(page, listener.deleted_version[0])