Esempio n. 1
0
    def test_download(self):
        OBJECT_DATA = 'objectData'
        OBJECT_NAME = 'objectName'

        self.mox.StubOutWithMock(api, 'chase_get_object_data')
        api.chase_get_object_data(IsA(http.HttpRequest),
                                  unicode(self.CONTAINER_NAME),
                                  unicode(OBJECT_NAME)).AndReturn(OBJECT_DATA)

        self.mox.ReplayAll()

        res = self.client.get(reverse(
                            'steer:engine:containers:object_download',
                            args=[self.CONTAINER_NAME, OBJECT_NAME]))

        self.assertEqual(res.content, OBJECT_DATA)
        self.assertTrue(res.has_header('Content-Disposition'))
Esempio n. 2
0
    def test_download(self):
        OBJECT_DATA = 'objectData'
        OBJECT_NAME = 'objectName'

        self.mox.StubOutWithMock(api, 'chase_get_object_data')
        api.chase_get_object_data(IsA(http.HttpRequest),
                                  unicode(self.CONTAINER_NAME),
                                  unicode(OBJECT_NAME)).AndReturn(OBJECT_DATA)

        self.mox.ReplayAll()

        res = self.client.get(
            reverse('steer:engine:containers:object_download',
                    args=[self.CONTAINER_NAME, OBJECT_NAME]))

        self.assertEqual(res.content, OBJECT_DATA)
        self.assertTrue(res.has_header('Content-Disposition'))
Esempio n. 3
0
def object_download(request, container_name, object_name):
    object_data = api.chase_get_object_data(request, container_name, object_name)

    response = http.HttpResponse()
    response["Content-Disposition"] = "attachment; filename=%s" % object_name
    for data in object_data:
        response.write(data)
    return response
Esempio n. 4
0
def object_download(request, container_name, object_name):
    object_data = api.chase_get_object_data(request, container_name,
                                            object_name)

    response = http.HttpResponse()
    response['Content-Disposition'] = 'attachment; filename=%s' % \
            object_name
    for data in object_data:
        response.write(data)
    return response