/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

Merged branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from cStringIO import StringIO
2
2
import logging
 
3
import tarfile
3
4
 
4
5
from paste.httpexceptions import HTTPServerError
5
6
 
12
13
from loggerhead.tests.test_simple import BasicTests
13
14
from loggerhead import util
14
15
 
15
 
from os import tmpnam
16
 
from tarfile import is_tarfile
17
 
 
18
16
 
19
17
class TestInventoryUI(BasicTests):
20
18
 
129
127
        self.assertEqual('2', annotated[0].change.revno)
130
128
        self.assertEqual('1', annotated[1].change.revno)
131
129
 
 
130
 
132
131
class TestDownloadTarballUI(BasicTests):
133
 
    
 
132
 
 
133
    def setUp(self):
 
134
        super(TestDownloadTarballUI, self).setUp()
 
135
        self.createBranch()
 
136
 
134
137
    def test_download_tarball(self):
135
138
        app = self.setUpLoggerhead()
136
139
        res = app.get('/tarball')
137
 
        tmpname = tmpnam()
138
 
        f = open(tmpname, 'w')
 
140
        f = open('tarball', 'w')
139
141
        f.write(res)
140
142
        f.close()
141
 
        self.failIf(not is_tarfile(tmpname))
 
143
        self.failIf(not tarfile.is_tarfile('tarball'))
 
144
        # Now check the content. TBC