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


Python test_info.MockInfo类代码示例

本文整理汇总了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()])
开发者ID:andresriancho,项目名称:w3af,代码行数:7,代码来源:test_knowledge_base.py

示例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)
开发者ID:0x554simon,项目名称:w3af,代码行数:11,代码来源:test_knowledge_base.py

示例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, ])
开发者ID:3rdDegree,项目名称:w3af,代码行数:12,代码来源:test_knowledge_base.py

示例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)
开发者ID:ElAleyo,项目名称:w3af,代码行数:15,代码来源:test_knowledge_base.py

示例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)
开发者ID:everping,项目名称:w3af,代码行数:10,代码来源:test_info_set.py

示例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)
开发者ID:everping,项目名称:w3af,代码行数:10,代码来源:test_info_set.py

示例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, ])
开发者ID:ElAleyo,项目名称:w3af,代码行数:14,代码来源:test_knowledge_base.py

示例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)
开发者ID:ElAleyo,项目名称:w3af,代码行数:6,代码来源:test_knowledge_base.py

示例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])
开发者ID:ElAleyo,项目名称:w3af,代码行数:14,代码来源:test_knowledge_base.py

示例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])
开发者ID:andresriancho,项目名称:w3af,代码行数:24,代码来源:test_knowledge_base.py

示例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,])
开发者ID:3rdDegree,项目名称:w3af,代码行数:14,代码来源:test_knowledge_base.py


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