MCPcopy
hub / github.com/aosabook/500lines / test_non_html

Method test_non_html

crawler/code/test.py:318–329  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

316 self.assertStat(content_type='foo')
317
318 def test_non_html(self):
319 # Should search only XML and HTML for links, not other content types.
320 body = ('<a href="{}">'.format(self.app_url)).encode('utf-8')
321
322 self.add_page('/xml', body=body, content_type='application/xml')
323 self.crawl([self.app_url + '/xml'])
324 self.assertStat(0, content_type='application/xml', num_urls=1)
325 self.assertStat(1, url=self.app_url + '/')
326
327 self.add_page('/image', content_type='image')
328 self.crawl([self.app_url + '/image'])
329 self.assertStat(content_type='image', num_urls=0)
330
331 def test_non_http(self):
332 body = '<a href="ftp://example.com">'.encode('utf-8')

Callers

nothing calls this directly

Calls 3

add_pageMethod · 0.95
crawlMethod · 0.95
assertStatMethod · 0.95

Tested by

no test coverage detected