~ubuntu-branches/ubuntu/trusty/swift/trusty-updates

« back to all changes in this revision

Viewing changes to test/unit/common/middleware/test_bulk.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, James Page, Chuck Short
  • Date: 2013-08-13 10:37:13 UTC
  • mfrom: (1.2.21)
  • Revision ID: package-import@ubuntu.com-20130813103713-1ctbx4zifyljs2aq
Tags: 1.9.1-0ubuntu1
[ James Page ]
* d/control: Update VCS fields for new branch locations.

[ Chuck Short ]
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    def __init__(self):
31
31
        self.calls = 0
32
32
        self.delete_paths = []
 
33
        self.max_pathlen = 100
33
34
 
34
35
    def __call__(self, env, start_response):
35
36
        self.calls += 1
44
45
                return Response(status='201 Created')(env, start_response)
45
46
            return Response(status=401)(env, start_response)
46
47
        if env['PATH_INFO'].startswith('/tar_works/'):
47
 
            if len(env['PATH_INFO']) > 100:
 
48
            if len(env['PATH_INFO']) > self.max_pathlen:
48
49
                return Response(status='400 Bad Request')(env, start_response)
49
50
            return Response(status='201 Created')(env, start_response)
50
51
        if env['PATH_INFO'].startswith('/delete_works/'):
51
52
            self.delete_paths.append(env['PATH_INFO'])
52
 
            if len(env['PATH_INFO']) > 100:
 
53
            if len(env['PATH_INFO']) > self.max_pathlen:
53
54
                return Response(status='400 Bad Request')(env, start_response)
54
55
            if env['PATH_INFO'].endswith('404'):
55
56
                return Response(status='404 Not Found')(env, start_response)
129
130
            req, '/create_cont_fail/acc/cont')
130
131
 
131
132
    def test_extract_tar_works(self):
 
133
        # On systems where $TMPDIR is long (like OS X), we need to do this
 
134
        # or else every upload will fail due to the path being too long.
 
135
        self.app.max_pathlen += len(self.testdir)
132
136
        for compress_format in ['', 'gz', 'bz2']:
133
137
            base_name = 'base_works_%s' % compress_format
134
138
            dir_tree = [
138
142
                             {'sub_dir3': [{'sub4_dir1': '../sub4 file1'}]},
139
143
                             {'sub_dir4': None},
140
144
                             ]}]
 
145
 
141
146
            build_dir_tree(self.testdir, dir_tree)
142
147
            mode = 'w'
143
148
            extension = ''