'The difficult thing with this test is that the scan will block until
we browse through the spider_man proxy to the spider_man.TERMINATE_URL,
so we need to start a "browser thread" that will sleep for a couple
of seconds before browsing through the proxy.
The first assert will be performed between the links that we browse
and the ones returned by the plugin to the core.
The second assert will check that the proxy actually returned the
expected HTTP response body to the browser.'

def generic_spiderman_run(self, run_config, url_resolver=get_moth_http, proxy_port=44444):

    bt = BrowserThread(url_resolver, proxy_port)
    bt.start()
    self._scan(run_config['target'], run_config['plugins'])
    bt.join()
    kb_urls = self.kb.get_all_known_urls()
    responses = bt.responses
    expected_response_contents = ('Trivial    Blind    SQL    injection', 'reachable    using    a    query    string', 'no    such    column:    abc', 'spider_man    plugin    finished    its    execution.')
    for (index, e_response) in enumerate(expected_response_contents):
        self.assertIn(e_response, responses[index])
    kb_urls = [u.uri2url().url_string for u in kb_urls]
    for (_, e_url, _) in BROWSE_URLS:
        self.assertIn(url_resolver(e_url), kb_urls)
