mirror of
https://github.com/jazzband/django-downloadview.git
synced 2026-03-16 22:40:25 +00:00
32 lines
1,008 B
Python
32 lines
1,008 B
Python
import django.test
|
|
|
|
from demoproject.compat import reverse
|
|
from django_downloadview import assert_download_response
|
|
|
|
|
|
class StaticPathTestCase(django.test.TestCase):
|
|
def test_download_response(self):
|
|
"""'static_path' serves 'fixtures/hello-world.txt'."""
|
|
url = reverse("path:static_path")
|
|
response = self.client.get(url)
|
|
assert_download_response(
|
|
self,
|
|
response,
|
|
content="Hello world!\n",
|
|
basename="hello-world.txt",
|
|
mime_type="text/plain",
|
|
)
|
|
|
|
|
|
class DynamicPathTestCase(django.test.TestCase):
|
|
def test_download_response(self):
|
|
"""'dynamic_path' serves 'fixtures/{path}'."""
|
|
url = reverse("path:dynamic_path", kwargs={"path": "hello-world.txt"})
|
|
response = self.client.get(url)
|
|
assert_download_response(
|
|
self,
|
|
response,
|
|
content="Hello world!\n",
|
|
basename="hello-world.txt",
|
|
mime_type="text/plain",
|
|
)
|