Beispiel #1
0
def test_contents(guides, soft_assert):
    """Test contents of each document."""
    pytest.sel.force_navigate("about")
    precomp_noguide = re.compile("(.*) Guide")
    cur_ver = version.current_version()
    for link in guides:
        locator = getattr(about, link)
        url = pytest.sel.get_attribute(locator, "href")
        data = requests.get(url, verify=False)
        pdf_titlepage_text_low = pdf_get_text(StringIO(data.content),
                                              [0]).lower()
        # don't include the word 'guide'
        title_text_low = precomp_noguide.search(
            pytest.sel.text(locator)).group(1).lower()
        expected = [title_text_low]
        if cur_ver == version.LATEST:
            expected.append('manageiq')
        else:
            expected.append('cloudforms')
            maj_min = '{}.{}'.format(cur_ver.version[0], cur_ver.version[1])
            expected.append(version.get_product_version(maj_min))

        for exp_str in expected:
            soft_assert(exp_str in pdf_titlepage_text_low,
                        "{} not in {}".format(exp_str, pdf_titlepage_text_low))
Beispiel #2
0
def test_contents(appliance, soft_assert):
    """Test title of each document."""
    view = navigate_to(appliance.server, 'Documentation')
    cur_ver = appliance.version
    for doc_type, title in doc_titles.items():
        doc_widget = getattr(view.links, doc_type, None)
        if not doc_widget:
            logger.warning('Skipping contents check for document: "{}: {}", no widget to read'
                           .format(doc_type, title))

        href = view.browser.get_attribute(attr='href',
                                          locator=doc_widget.link.locator)
        data = requests.get(href, verify=False)
        pdf_titlepage_text_low = pdf_get_text(StringIO(data.content), [0]).lower()
        # don't include the word 'guide'
        expected = [title]
        if cur_ver == version.LATEST:
            expected.append('manageiq')
        else:
            expected.append('cloudforms')
            maj_min = '{}.{}'.format(cur_ver.version[0], cur_ver.version[1])
            expected.append(version.get_product_version(maj_min))

        for exp_str in expected:
            soft_assert(exp_str in pdf_titlepage_text_low, "{} not in {}"
                                                           .format(exp_str, pdf_titlepage_text_low))
Beispiel #3
0
def test_contents(appliance, soft_assert):
    """Test title of each document."""
    view = navigate_to(appliance.server, 'Documentation')
    cur_ver = appliance.version
    for doc_type, title in doc_titles.items():
        doc_widget = getattr(view.links, doc_type, None)
        if not doc_widget:
            logger.warning(
                'Skipping contents check for document: "{}: {}", no widget to read'
                .format(doc_type, title))

        href = view.browser.get_attribute(attr='href',
                                          locator=doc_widget.link.locator)
        data = requests.get(href, verify=False)
        pdf_titlepage_text_low = pdf_get_text(StringIO(data.content),
                                              [0]).lower()
        # don't include the word 'guide'
        expected = [title]
        if cur_ver == version.LATEST:
            expected.append('manageiq')
        else:
            expected.append('cloudforms')
            maj_min = '{}.{}'.format(cur_ver.version[0], cur_ver.version[1])
            expected.append(version.get_product_version(maj_min))

        for exp_str in expected:
            soft_assert(exp_str in pdf_titlepage_text_low,
                        "{} not in {}".format(exp_str, pdf_titlepage_text_low))
def test_contents(docs_content, guides, soft_assert):
    """Test contents of each document."""
    navigate_to(current_appliance.server, "Documentation")
    cur_ver = version.current_version()
    for link in guides:
        locator = getattr(about, link)
        url = pytest.sel.get_attribute(locator, "href")
        data = requests.get(url, verify=False)
        pdf_titlepage_text_low = pdf_get_text(StringIO(data.content), [0]).lower()
        # don't include the word 'guide'
        title_text_low = docs_content[link]
        expected = [title_text_low]
        if cur_ver == version.LATEST:
            expected.append("manageiq")
        else:
            expected.append("cloudforms")
            maj_min = "{}.{}".format(cur_ver.version[0], cur_ver.version[1])
            expected.append(version.get_product_version(maj_min))

        for exp_str in expected:
            soft_assert(exp_str in pdf_titlepage_text_low, "{} not in {}".format(exp_str, pdf_titlepage_text_low))
Beispiel #5
0
def test_contents(guides, soft_assert):
    """Test contents of each document."""
    pytest.sel.force_navigate("about")
    precomp_noguide = re.compile("(.*) Guide")
    cur_ver = version.current_version()
    for link in guides:
        locator = getattr(about, link)
        url = pytest.sel.get_attribute(locator, "href")
        data = requests.get(url, verify=False)
        pdf_titlepage_text_low = pdf_get_text(StringIO(data.content), [0]).lower()
        # don't include the word 'guide'
        title_text_low = precomp_noguide.search(pytest.sel.text(locator)).group(1).lower()
        expected = [title_text_low]
        if cur_ver == version.LATEST:
            expected.append('manageiq')
        else:
            expected.append('cloudforms')
            maj_min = '{}.{}'.format(cur_ver.version[0], cur_ver.version[1])
            expected.append(version.get_product_version(maj_min))

        for exp_str in expected:
            soft_assert(exp_str in pdf_titlepage_text_low,
                "{} not in {}".format(exp_str, pdf_titlepage_text_low))
Beispiel #6
0
def test_contents(docs_content, guides, soft_assert):
    """Test contents of each document."""
    navigate_to(current_appliance.server, 'Documentation')
    cur_ver = version.current_version()
    for link in guides:
        locator = getattr(about, link)
        url = pytest.sel.get_attribute(locator, "href")
        data = requests.get(url, verify=False)
        pdf_titlepage_text_low = pdf_get_text(StringIO(data.content),
                                              [0]).lower()
        # don't include the word 'guide'
        title_text_low = docs_content[link]
        expected = [title_text_low]
        if cur_ver == version.LATEST:
            expected.append('manageiq')
        else:
            expected.append('cloudforms')
            maj_min = '{}.{}'.format(cur_ver.version[0], cur_ver.version[1])
            expected.append(version.get_product_version(maj_min))

        for exp_str in expected:
            soft_assert(exp_str in pdf_titlepage_text_low,
                        "{} not in {}".format(exp_str, pdf_titlepage_text_low))