Skip to content

Commit c29e53e

Browse files
committed
Fix failing test
1 parent 8bdbabf commit c29e53e

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

tests/test_docs.py

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from pathlib import Path
22
import pytest
3+
import os
34

45
from attack_flow.docs import (
56
generate_example_flows,
@@ -379,31 +380,36 @@ def test_human_name():
379380
def test_generate_example_flows():
380381
jsons = [Path("tests/fixtures/flow1.json"), Path("tests/fixtures/flow2.json")]
381382
afds = [Path("tests/fixtures/flow1.afd")]
383+
os.environ["DOCS_BASE_URL"] = "https://foo.com/bar/"
382384
result = generate_example_flows(jsons, afds)
383385
assert result == [
384-
".. list-table::",
385-
" :widths: 30 20 50",
386-
" :header-rows: 1",
386+
"----",
387+
"",
388+
"**Test Flow 1**",
389+
"",
390+
"*Author:* John Doe",
391+
"",
392+
"*Description:* Test flow 1 is used for unit tests.",
393+
"",
394+
".. raw:: html",
395+
"",
396+
' <p><em>Open:</em> <a href="../ui/?src=https%3A//foo.com/bar/corpus/flow1.afb" target="_blank">Attack Flow Builder</a></p>',
397+
' <p><em>Download:</em> <a href="../corpus/flow1.afb" download>Attack Flow</a> | <a href="../corpus/flow1.json" download>STIX</a> | <a href="../corpus/flow1.dot" download>GraphViz</a> (<a href="../corpus/flow1.dot.png">PNG</a>) | <a href="../corpus/flow1.mmd" download>Mermaid</a></p>',
398+
"",
399+
"----",
387400
"",
388-
" * - Report",
389-
" - Authors",
390-
" - Description",
391-
" * - **Test Flow 1**",
401+
"**Test Flow 2**",
392402
"",
393-
" .. raw:: html",
403+
"*Author:* Jane Doe",
394404
"",
395-
' <p><em>Open:</em> <a target="_blank" href="../ui/?src=..%2fcorpus%2fflow1.afb"></i>Attack Flow Builder</a></p>',
396-
' <p><em>Download:</em> <a href="../corpus/flow1.json" download>JSON</a> | <a href="../corpus/flow1.dot">GraphViz</a> (<a href="../corpus/flow1.dot.png">PNG</a>) | <a href="../corpus/flow1.mmd">Mermaid</a>',
397-
" - John Doe",
398-
" - Test flow 1 is used for unit tests.",
405+
"*Description:* Test flow 2 is used for unit tests.",
399406
"",
400-
" * - **Test Flow 2**",
407+
".. raw:: html",
401408
"",
402-
" .. raw:: html",
409+
' <p><em>Open:</em> <a href="../ui/?src=https%3A//foo.com/bar/corpus/flow2.afb" target="_blank">Attack Flow Builder</a></p>',
410+
' <p><em>Download:</em> <a href="../corpus/flow2.afb" download>Attack Flow</a> | <a href="../corpus/flow2.json" download>STIX</a> | <a href="../corpus/flow2.dot" download>GraphViz</a> (<a href="../corpus/flow2.dot.png">PNG</a>) | <a href="../corpus/flow2.mmd" download>Mermaid</a></p>',
403411
"",
404-
' <p><em>Download:</em> <a href="../corpus/flow2.json" download>JSON</a> | <a href="../corpus/flow2.dot">GraphViz</a> (<a href="../corpus/flow2.dot.png">PNG</a>) | <a href="../corpus/flow2.mmd">Mermaid</a>',
405-
" - Jane Doe",
406-
" - Test flow 2 is used for unit tests.",
412+
"----",
407413
"",
408414
"",
409415
]

0 commit comments

Comments
 (0)