File: test_jinja_content_option.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 (40 lines) | stat: -rw-r--r-- 1,392 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
34
35
36
37
38
39
40
from pathlib import Path

import pytest


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

    assert "Nested Spec Need" in html
    assert "Jinja Content Not Implemented" in html
    assert "JINJAID125" in html
    assert "JINJAID126" in html
    assert (
        """<p>Nested need with <code class="docutils literal notranslate"><span class="pre">:jinja_content:</span></code> option set to <code class="docutils literal notranslate"><span class="pre">true</span></code>.
This requirement has tags: <strong>user, login</strong>.</p>
<p>It links to:</p>
<ul class="simple">
<li><p>JINJAID126</p></li>
</ul>"""
        in html
    )
    assert (
        """<p>Need with <code class="docutils literal notranslate"><span class="pre">:jinja_content:</span></code> equal to <code class="docutils literal notranslate"><span class="pre">true</span></code>.
This requirement has status: <strong>open</strong>.</p>"""
        in html
    )

    # Test for needs_render_context
    assert "JINJA1D8913" in html
    assert "Project_X" in html
    assert "Content from custom_defined_func." in html
    assert "Daniel - ID: 811982" in html
    assert "Marco - ID: 234232" in html