'Test the extractor\'s behaviour for links with rel="nofollow"'

def test_nofollow(self):

    html = '<html><head><title>Page    title<title>\n                                                <body>\n                                                <div    class=\'links\'>\n                                                <p><a    href="/about.html">About    us</a></p>\n                                                </div>\n                                                <div>\n                                                <p><a    href="/follow.html">Follow    this    link</a></p>\n                                                </div>\n                                                <div>\n                                                <p><a    href="/nofollow.html"    rel="nofollow">Dont    follow    this    one</a></p>\n                                                </div>\n                                                <div>\n                                                <p><a    href="/nofollow2.html"    rel="blah">Choose    to    follow    or    not</a></p>\n                                                </div>\n                                                <div>\n                                                <p><a    href="http://google.com/something"    rel="external    nofollow">External    link    not    to    follow</a></p>\n                                                </div>\n                                                </body></html>'
    response = HtmlResponse('http://example.org/somepage/index.html', body=html)
    lx = self.extractor_cls()
    self.assertEqual(lx.extract_links(response), [Link(url='http://example.org/about.html', text=u'About    us'), Link(url='http://example.org/follow.html', text=u'Follow    this    link'), Link(url='http://example.org/nofollow.html', text=u'Dont    follow    this    one', nofollow=True), Link(url='http://example.org/nofollow2.html', text=u'Choose    to    follow    or    not'), Link(url='http://google.com/something', text=u'External    link    not    to    follow', nofollow=True)])
