django-downloadview/django_downloadview/tests/response.py
CJ 616c822b6c refs #87 Quotes around ascii filename, not utf-8
Updated the test to go with my change.
2014-06-06 10:37:54 -04:00

19 lines
796 B
Python

# -*- coding: utf-8 -*-
"""Unit tests around responses."""
import unittest
from django_downloadview.response import DownloadResponse
class DownloadResponseTestCase(unittest.TestCase):
"""Tests around :class:`django_downloadviews.response.DownloadResponse`."""
def test_content_disposition_encoding(self):
"""Content-Disposition header is encoded."""
response = DownloadResponse('fake file',
attachment=True,
basename=u'espacé .txt',)
headers = response.default_headers
self.assertIn("filename=\"espace_.txt\"",
headers['Content-Disposition'])
self.assertIn("filename*=UTF-8''espac%C3%A9%20.txt",
headers['Content-Disposition'])