/loggerhead/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/loggerhead/trunk

« back to all changes in this revision

Viewing changes to loggerhead/tests/test_controllers.py

  • Committer: Martin Pool
  • Date: 2011-11-24 06:10:44 UTC
  • mto: This revision was merged to the branch mainline in revision 461.
  • Revision ID: mbp@canonical.com-20111124061044-t4ee80uby0xlf72r
Fix broken TestDownloadTarballUI

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
from cStringIO import StringIO
18
18
import logging
19
19
import tarfile
 
20
import tempfile
20
21
 
21
22
from paste.httpexceptions import HTTPServerError
22
23
 
294
295
    def test_download_tarball(self):
295
296
        app = self.setUpLoggerhead()
296
297
        res = app.get('/tarball')
297
 
        f = open('tarball', 'w')
298
 
        f.write(res)
299
 
        f.close()
300
 
        self.failIf(not tarfile.is_tarfile('tarball'))
 
298
        f = tempfile.NamedTemporaryFile()
 
299
        self.addCleanup(f.close)
 
300
        f.write(res.body)
 
301
        self.failIf(not tarfile.is_tarfile(f.name))