import pytest
from bs4 import BeautifulSoup

from upol_crawler.core import link_extractor


@pytest.mark.parametrize('html, result', [
    ('<meta name="generator" content="MediaWiki 1.26.2">', True),
    ('<meta name="generator" content="MediaWiki 1.2">', True),
    ('<meta name="generator" content="MediaWiki">', True),
    ('<meta name="generator" content="AAA"><meta name="generator" content="MediaWiki 1.26.2">', True),
    ])
def test_is_page_wiki(html, result):
    soup = BeautifulSoup(html, "lxml")
    assert link_extractor.is_page_wiki(soup) == result


@pytest.mark.parametrize('html, result', [
    ('<a href="aaaa" rel="nofollow">', False),
    ('<a href="aaaa" rel="bookmark">', False),
    ('<a href="aaaa" rel="alternate">', False),
    ('<a href="aaaa" rel="license">', False),
    ('<a href="aaaa" rel="search">', False),
    ('<a href="aaaa">', True),
    ])
def test_check_rel_attribute(html, result):
    soup = BeautifulSoup(html, "lxml")
    links = soup.find_all('a', href=True)
    assert link_extractor.check_rel_attribute(links[0]) == result

@@ -1052,20 +1052,331 @@
 links%5B0%5D) == result%0A
+%0A%0A@pytest.mark.parametrize('html, result', %5B%0A    ('%3Cmeta name=%22robots%22 content=%22noindex,nofollow%22%3E', False),%0A    ('%3Cmeta name=%22robots%22 content=%22noindex%22%3E', True),%0A    %5D)%0Adef test_check_meta_robots(html, result):%0A    soup = BeautifulSoup(html, %22lxml%22)%0A    assert link_extractor.check_meta_robots(soup) == result%0A

Add meta robots tests