File: test_role_need.py

package info (click to toggle)
sphinx-needs 5.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 11,924 kB
  • sloc: python: 21,132; javascript: 187; makefile: 89; sh: 29; xml: 10
file content (33 lines) | stat: -rw-r--r-- 883 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from pathlib import Path

import pytest


@pytest.mark.parametrize(
    "test_app",
    [{"buildername": "html", "srcdir": "doc_test/role_need_doc"}],
    indirect=True,
)
def test_role_need(test_app):
    app = test_app
    app.build()
    html = Path(app.outdir, "index.html").read_text()

    # Normal need ref
    assert (
        '<a class="reference internal" href="#REQ_1" title="REQ_1">'
        '<em class="xref need">Test requirement 1 (REQ_1)</em></a>' in html
    )

    # Imported need ref
    assert (
        '<a class="reference internal" href="#IMP_TEST_01" title="IMP_TEST_01">'
        '<em class="xref need">TEST_01 DESCRIPTION (IMP_TEST_01)</em></a>' in html
    )

    # External need ref
    assert (
        '<a class="external_link reference external" '
        'href="http://my_company.com/docs/v1/index.html#TEST_01">EXT_TEST_01</a>'
        in html
    )