mirror of
https://github.com/jazzband/django-downloadview.git
synced 2026-03-16 22:40:25 +00:00
28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
from django.core.urlresolvers import reverse
|
|
import django.test
|
|
|
|
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')
|