Exemplo n.º 1
0
def test_keyword_url_nokw():
    from django_check_seo.checks_list import check_keyword_url
    from django_check_seo.checks_list import check_keywords

    site = init()
    check_keywords.run(site)
    site.full_url = "https://localhost/fake-url/notitle-of-the-page"
    check_keyword_url.run(site)

    for problem in site.problems:
        if problem.name == "No keyword in URL":
            assert problem.name == "No keyword in URL"
            assert problem.settings == "at least one"
            assert problem.found == "none"
            assert problem.searched_in == [
                "https://localhost/fake-url/notitle-of-the-page"
            ]
Exemplo n.º 2
0
def test_keyword_url_nokw_root():
    from django_check_seo.checks_list import check_keyword_url
    from django_check_seo.checks_list import check_keywords

    site = init()
    check_keywords.run(site)
    site.full_url = "https://localhost/"
    check_keyword_url.run(site)

    for success in site.success:
        if success.name == "Keywords found in URL":
            raise ValueError("We don't espect kw to be found in root URL")

    for problem in site.problems:
        if problem.name == "No keyword in URL":
            raise ValueError(
                "We shouldnt return a problem if a keyword is not found in root URL"
            )
Exemplo n.º 3
0
def test_keyword_url_kws():
    from django_check_seo.checks_list import check_keyword_url
    from django_check_seo.checks_list import check_keywords

    site = init()
    site.soup.select('meta[name="keywords"]')[0]["content"] = "title,  page"

    check_keywords.run(site)
    site.full_url = "https://localhost/fake-url/title-of-the-page"

    check_keyword_url.run(site)

    for success in site.success:
        if success.name == "Keywords found in URL":
            assert success.name == "Keywords found in URL"
            assert success.settings == "at least one"
            assert success.found == "title, page"
            assert success.searched_in == [
                'https://localhost/fake-url/<b class="good">title</b>-of-the-<b class="good">page</b>'
            ]
Exemplo n.º 4
0
def test_keyword_url_kw():
    from django_check_seo.checks_list import check_keyword_url
    from django_check_seo.checks_list import check_keywords

    site = init()

    check_keywords.run(site)
    check_keyword_url.run(site)

    for success in site.success:
        if success.name == "Keywords found in URL":
            assert success.name == "Keywords found in URL"
            assert success.settings == "at least one"
            assert success.found == "title"
            assert success.searched_in == [
                'https://localhost/fake-url/<b class="good">title</b>-of-the-page/'
            ]
            assert (
                success.description ==
                'Keywords in URL will help your users understand the organisation of your website, and are a small ranking factor for Google. On the other hand, Bing guidelines advises to "<i>keep [your URL] clean and keyword rich when possible</i>".'
            )