Esempio n. 1
0
    def test_sendfile_debug(self):
        with self.settings(DEBUG=True):
            resp = sendfile('/foo')
            self.assertEqual(resp['X-Accel-Redirect'], '/foo')
            self.assertEqual(resp.content, '/foo')

        with self.settings(DEBUG=False):
            resp = sendfile('/foo')
            self.assertEqual(resp['X-Accel-Redirect'], '/foo')
            self.assertEqual(resp.content, '')
Esempio n. 2
0
    def get(self, request, conversation):
        direction = request.GET.get('direction', 'inbound')
        if direction not in ['inbound', 'outbound']:
            raise Http404()

        url = '/message_store_exporter/%s/%s.json' % (conversation.batch.key,
                                                      direction)
        return sendfile(url, buffering=False, filename='%s-%s.json' % (
            conversation.key, direction))
Esempio n. 3
0
 def test_sendfile_streaming(self):
     resp = sendfile('/foo', buffering=False)
     self.assertEqual(resp['X-Accel-Redirect'], '/foo')
     self.assertEqual(resp['X-Accel-Buffering'], 'no')
Esempio n. 4
0
 def test_sendfile(self):
     resp = sendfile('/foo')
     self.assertEqual(resp['X-Accel-Redirect'], '/foo')
     self.assertEqual(resp['X-Accel-Buffering'], 'yes')