|
1 | 1 | from pathlib import Path |
2 | 2 | import pytest |
| 3 | +import os |
3 | 4 |
|
4 | 5 | from attack_flow.docs import ( |
5 | 6 | generate_example_flows, |
@@ -379,31 +380,36 @@ def test_human_name(): |
379 | 380 | def test_generate_example_flows(): |
380 | 381 | jsons = [Path("tests/fixtures/flow1.json"), Path("tests/fixtures/flow2.json")] |
381 | 382 | afds = [Path("tests/fixtures/flow1.afd")] |
| 383 | + os.environ["DOCS_BASE_URL"] = "https://foo.com/bar/" |
382 | 384 | result = generate_example_flows(jsons, afds) |
383 | 385 | 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 | + "----", |
387 | 400 | "", |
388 | | - " * - Report", |
389 | | - " - Authors", |
390 | | - " - Description", |
391 | | - " * - **Test Flow 1**", |
| 401 | + "**Test Flow 2**", |
392 | 402 | "", |
393 | | - " .. raw:: html", |
| 403 | + "*Author:* Jane Doe", |
394 | 404 | "", |
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.", |
399 | 406 | "", |
400 | | - " * - **Test Flow 2**", |
| 407 | + ".. raw:: html", |
401 | 408 | "", |
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>', |
403 | 411 | "", |
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 | + "----", |
407 | 413 | "", |
408 | 414 | "", |
409 | 415 | ] |
0 commit comments