本文整理汇总了Python中w3af.core.data.kb.tests.test_info.MockInfo类的典型用法代码示例。如果您正苦于以下问题:Python MockInfo类的具体用法?Python MockInfo怎么用?Python MockInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MockInfo类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_all_uniq_ids_iter_include_ids
def test_get_all_uniq_ids_iter_include_ids(self):
i1 = MockInfo()
kb.append('a', 'b', i1)
uniq_ids = [u for u in kb.get_all_uniq_ids_iter(include_ids=[i1.get_uniq_id()])]
self.assertEqual(uniq_ids, [i1.get_uniq_id()])
示例2: test_observer_update
def test_observer_update(self):
observer1 = Mock()
info = MockInfo()
kb.add_observer(observer1)
kb.append('a', 'b', info)
old_info = copy.deepcopy(info)
info.set_name('new name')
kb.update(old_info, info)
observer1.update.assert_called_once_with(old_info, info)
示例3: test_append_uniq_var_bug_10Dec2012
def test_append_uniq_var_bug_10Dec2012(self):
i1 = MockInfo()
i1.set_uri(URL('http://moth/abc.html'))
i1.set_var('id')
i2 = MockInfo()
i2.set_uri(URL('http://moth/abc.html'))
i2.set_var('id')
kb.append_uniq('a', 'b', i1)
kb.append_uniq('a', 'b', i2)
self.assertEqual(kb.get('a', 'b'), [i1, ])
示例4: test_get_by_uniq_id_duplicated_ignores_second
def test_get_by_uniq_id_duplicated_ignores_second(self):
"""
TODO: Analyze this case, i1 and i2 have both the same ID because they
have all the same information (this is very very uncommon in a
real w3af run).
Note that in the get_by_uniq_id call i2 is not returned.
"""
i1 = MockInfo()
i2 = MockInfo()
kb.append('a', 'b', i1)
kb.append('a', 'b', i2)
i1_copy = kb.get_by_uniq_id(i1.get_uniq_id())
self.assertEqual(i1_copy, i1)
示例5: test_get_desc_template_special_chars_unicode
def test_get_desc_template_special_chars_unicode(self):
i1 = MockInfo()
i1.set_url(URL('http://w3af.org/1'))
i2 = MockInfo()
i2.set_url(URL('http://w3af.org/2\xc3\xb6'))
tiset = TemplatedInfoSetPrintUri([i1, i2])
expected = u' - http://w3af.org/1\n - http://w3af.org/2ö\n'
self.assertEqual(tiset.get_desc(), expected)
示例6: test_get_desc_urls
def test_get_desc_urls(self):
i1 = MockInfo()
i1.set_url(URL('http://w3af.org/1'))
i2 = MockInfo()
i2.set_url(URL('http://w3af.org/2'))
tiset = TemplatedInfoSetPrintUri([i1, i2])
expected = u' - http://w3af.org/2\n - http://w3af.org/1\n'
self.assertEqual(tiset.get_desc(), expected)
示例7: test_append_uniq_var_default
def test_append_uniq_var_default(self):
i1 = MockInfo()
i1.set_uri(URL('http://moth/abc.html?id=1'))
i1.set_dc(QueryString([('id', ['1'])]))
i1.set_token(('id', 0))
i2 = MockInfo()
i2.set_uri(URL('http://moth/abc.html?id=3'))
i2.set_dc(QueryString([('id', ['3'])]))
i2.set_token(('id', 0))
kb.append_uniq('a', 'b', i1)
kb.append_uniq('a', 'b', i2)
self.assertEqual(kb.get('a', 'b'), [i1, ])
示例8: test_get_by_uniq_id
def test_get_by_uniq_id(self):
i1 = MockInfo()
kb.append('a', 'b', i1)
i1_copy = kb.get_by_uniq_id(i1.get_uniq_id())
self.assertEqual(i1_copy, i1)
示例9: test_append_uniq_url_different
def test_append_uniq_url_different(self):
i1 = MockInfo()
i1.set_uri(URL('http://moth/abc.html?id=1'))
i1.set_dc(QueryString([('id', ['1'])]))
i1.set_token(('id', 0))
i2 = MockInfo()
i2.set_uri(URL('http://moth/def.html?id=3'))
i2.set_dc(QueryString([('id', ['3'])]))
i2.set_token(('id', 0))
kb.append_uniq('a', 'b', i1, filter_by='URL')
kb.append_uniq('a', 'b', i2, filter_by='URL')
self.assertEqual(kb.get('a', 'b'), [i1, i2])
示例10: test_append_uniq_var_not_uniq_diff_token_name_three
def test_append_uniq_var_not_uniq_diff_token_name_three(self):
i1 = MockInfo()
i1.set_uri(URL('http://moth/abc.html?id=1&foo=bar'))
i1.set_dc(QueryString([('id', ['1']),
('foo', ['bar'])]))
i1.set_token(('id', 0))
i2 = MockInfo()
i2.set_uri(URL('http://moth/abc.html?id=1&foo=bar'))
i2.set_dc(QueryString([('id', ['3']),
('foo', ['bar'])]))
i2.set_token(('foo', 0))
# This instance duplicates i2
i3 = MockInfo()
i3.set_uri(URL('http://moth/abc.html?id=1&foo=bar'))
i3.set_dc(QueryString([('id', ['3']),
('foo', ['bar'])]))
i3.set_token(('foo', 0))
kb.append_uniq('a', 'b', i1)
kb.append_uniq('a', 'b', i2)
kb.append_uniq('a', 'b', i3)
self.assertEqual(kb.get('a', 'b'), [i1, i2])
示例11: test_append_uniq_url_uniq
def test_append_uniq_url_uniq(self):
i1 = MockInfo()
i1.set_uri(URL('http://moth/abc.html?id=1'))
i1.set_dc(QueryString([('id', '1')]))
i1.set_var('id')
i2 = MockInfo()
i2.set_uri(URL('http://moth/abc.html?id=3'))
i2.set_dc(QueryString([('id', '3')]))
i2.set_var('id')
kb.append_uniq('a', 'b', i1, filter_by='URL')
kb.append_uniq('a', 'b', i2, filter_by='URL')
self.assertEqual(kb.get('a', 'b'), [i1,])