本文整理匯總了Python中core.data.db.history.HistoryItem.toggle_mark方法的典型用法代碼示例。如果您正苦於以下問題:Python HistoryItem.toggle_mark方法的具體用法?Python HistoryItem.toggle_mark怎麽用?Python HistoryItem.toggle_mark使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類core.data.db.history.HistoryItem
的用法示例。
在下文中一共展示了HistoryItem.toggle_mark方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: toggle_bookmark
# 需要導入模塊: from core.data.db.history import HistoryItem [as 別名]
# 或者: from core.data.db.history.HistoryItem import toggle_mark [as 別名]
def toggle_bookmark(self, cell, path, model):
"""Toggle bookmark."""
model[path][1] = not model[path][1]
historyItem = HistoryItem()
historyItem.load(model[path][0])
historyItem.toggle_mark(True)
return
示例2: test_find
# 需要導入模塊: from core.data.db.history import HistoryItem [as 別名]
# 或者: from core.data.db.history.HistoryItem import toggle_mark [as 別名]
def test_find(self):
find_id = random.randint(1, 499)
url = URL("http://w3af.org/a/b/foobar.php?foo=123")
tag_value = rand_alnum(10)
for i in xrange(0, 500):
request = HTTPRequest(url, data="a=1")
code = 200
if i == find_id:
code = 302
hdr = Headers([("Content-Type", "text/html")])
res = HTTPResponse(code, "<html>", hdr, url, url)
h1 = HistoryItem()
h1.request = request
res.set_id(i)
h1.response = res
if i == find_id:
h1.toggle_mark()
h1.update_tag(tag_value)
h1.save()
h2 = HistoryItem()
self.assertEqual(len(h2.find([("tag", "%" + tag_value + "%", "like")])), 1)
self.assertEqual(len(h2.find([("code", 302, "=")])), 1)
self.assertEqual(len(h2.find([("mark", 1, "=")])), 1)
self.assertEqual(len(h2.find([("has_qs", 1, "=")])), 500)
self.assertEqual(len(h2.find([("has_qs", 1, "=")], result_limit=10)), 10)
results = h2.find([("has_qs", 1, "=")], result_limit=1, orderData=[("id", "desc")])
self.assertEqual(results[0].id, 499)
search_data = []
search_data.append(("id", find_id + 1, "<"))
search_data.append(("id", find_id - 1, ">"))
self.assertEqual(len(h2.find(search_data)), 1)
示例3: test_mark
# 需要導入模塊: from core.data.db.history import HistoryItem [as 別名]
# 或者: from core.data.db.history.HistoryItem import toggle_mark [as 別名]
def test_mark(self):
mark_id = 3
url = URL("http://w3af.org/a/b/c.php")
for i in xrange(0, 500):
request = HTTPRequest(url, data="a=1")
hdr = Headers([("Content-Type", "text/html")])
res = HTTPResponse(200, "<html>", hdr, url, url)
h1 = HistoryItem()
h1.request = request
res.set_id(i)
h1.response = res
if i == mark_id:
h1.toggle_mark()
h1.save()
h2 = HistoryItem()
h2.load(mark_id)
self.assertTrue(h2.mark)
h3 = HistoryItem()
h3.load(mark_id - 1)
self.assertFalse(h3.mark)