Test that downloads with the same filename are still handled correctly

This commit is contained in:
Dmitry Shachnev 2019-06-03 16:28:41 +03:00
parent 6fc8873087
commit 9df6e40145
3 changed files with 9 additions and 0 deletions

View File

@ -0,0 +1 @@
this one will have some content

View File

@ -2,5 +2,6 @@ test-roles-download
===================
* :download:`dummy.dat`
* :download:`another/dummy.dat`
* :download:`not_found.dat`
* :download:`Sphinx logo <http://www.sphinx-doc.org/en/master/_static/sphinxheader.png>`

View File

@ -453,6 +453,8 @@ def test_html_download_role(app, status, warning):
app.build()
digest = md5(b'dummy.dat').hexdigest()
assert (app.outdir / '_downloads' / digest / 'dummy.dat').exists()
digest_another = md5(b'another/dummy.dat').hexdigest()
assert (app.outdir / '_downloads' / digest_another / 'dummy.dat').exists()
content = (app.outdir / 'index.html').text()
assert (('<li><p><a class="reference download internal" download="" '
@ -460,6 +462,11 @@ def test_html_download_role(app, status, warning):
'<code class="xref download docutils literal notranslate">'
'<span class="pre">dummy.dat</span></code></a></p></li>' % digest)
in content)
assert (('<li><p><a class="reference download internal" download="" '
'href="_downloads/%s/dummy.dat">'
'<code class="xref download docutils literal notranslate">'
'<span class="pre">another/dummy.dat</span></code></a></p></li>' %
digest_another) in content)
assert ('<li><p><code class="xref download docutils literal notranslate">'
'<span class="pre">not_found.dat</span></code></p></li>' in content)
assert ('<li><p><a class="reference download external" download="" '