| 1 |
from unittest.mock import Mock |
| 2 |
|
| 3 |
from sphinx_reredirects import Reredirects |
| 4 |
|
| 5 |
|
| 6 |
def test_wildcard_expansion(): |
| 7 |
sphinx_mock = Mock() |
| 8 |
sphinx_mock.config.redirects = { |
| 9 |
"faq/*": "http://new.com/faq/", |
| 10 |
"welcome": "intro.html", |
| 11 |
} |
| 12 |
sphinx_mock.config.redirect_html_template_file = None |
| 13 |
sphinx_mock.env.found_docs = ["faq/one", "faq/two", "intro"] |
| 14 |
actual = Reredirects(sphinx_mock).grab_redirects() |
| 15 |
expected = { |
| 16 |
"faq/one": "http://new.com/faq/", |
| 17 |
"faq/two": "http://new.com/faq/", |
| 18 |
"welcome": "intro.html", |
| 19 |
} |
| 20 |
|
| 21 |
assert actual == expected |