"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/unit/common/middleware/test_quotas.py" between
swift-2.19.1.tar.gz and swift-2.21.0.tar.gz

About: OpenStack swift is software for creating redundant, scalable object storage using clusters of commodity servers to store terabytes or even petabytes of accessible data (now supporting storage policies).
The "Stein" series (latest release).

test_quotas.py  (swift-2.19.1):test_quotas.py  (swift-2.21.0)
skipping to change at line 92 skipping to change at line 92
def test_exceed_bytes_quota(self): def test_exceed_bytes_quota(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {}) app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
cache = FakeCache({'bytes': 0, 'meta': {'quota-bytes': '2'}}) cache = FakeCache({'bytes': 0, 'meta': {'quota-bytes': '2'}})
req = Request.blank( req = Request.blank(
'/v1/a/c/o', '/v1/a/c/o',
environ={'REQUEST_METHOD': 'PUT', 'swift.cache': cache, environ={'REQUEST_METHOD': 'PUT', 'swift.cache': cache,
'CONTENT_LENGTH': '100'}) 'CONTENT_LENGTH': '100'})
res = req.get_response(app) res = req.get_response(app)
self.assertEqual(res.status_int, 413) self.assertEqual(res.status_int, 413)
self.assertEqual(res.body, 'Upload exceeds quota.') self.assertEqual(res.body, b'Upload exceeds quota.')
def test_not_exceed_bytes_quota(self): def test_not_exceed_bytes_quota(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {}) app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
cache = FakeCache({'bytes': 0, 'meta': {'quota-bytes': '100'}}) cache = FakeCache({'bytes': 0, 'meta': {'quota-bytes': '100'}})
req = Request.blank( req = Request.blank(
'/v1/a/c/o', '/v1/a/c/o',
environ={'REQUEST_METHOD': 'PUT', 'swift.cache': cache, environ={'REQUEST_METHOD': 'PUT', 'swift.cache': cache,
'CONTENT_LENGTH': '100'}) 'CONTENT_LENGTH': '100'})
res = req.get_response(app) res = req.get_response(app)
self.assertEqual(res.status_int, 200) self.assertEqual(res.status_int, 200)
def test_exceed_counts_quota(self): def test_exceed_counts_quota(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {}) app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
cache = FakeCache({'object_count': 1, 'meta': {'quota-count': '1'}}) cache = FakeCache({'object_count': 1, 'meta': {'quota-count': '1'}})
req = Request.blank( req = Request.blank(
'/v1/a/c/o', '/v1/a/c/o',
environ={'REQUEST_METHOD': 'PUT', 'swift.cache': cache, environ={'REQUEST_METHOD': 'PUT', 'swift.cache': cache,
'CONTENT_LENGTH': '100'}) 'CONTENT_LENGTH': '100'})
res = req.get_response(app) res = req.get_response(app)
self.assertEqual(res.status_int, 413) self.assertEqual(res.status_int, 413)
self.assertEqual(res.body, 'Upload exceeds quota.') self.assertEqual(res.body, b'Upload exceeds quota.')
def test_not_exceed_counts_quota(self): def test_not_exceed_counts_quota(self):
app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {}) app = container_quotas.ContainerQuotaMiddleware(FakeApp(), {})
cache = FakeCache({'object_count': 1, 'meta': {'quota-count': '2'}}) cache = FakeCache({'object_count': 1, 'meta': {'quota-count': '2'}})
req = Request.blank( req = Request.blank(
'/v1/a/c/o', '/v1/a/c/o',
environ={'REQUEST_METHOD': 'PUT', 'swift.cache': cache, environ={'REQUEST_METHOD': 'PUT', 'swift.cache': cache,
'CONTENT_LENGTH': '100'}) 'CONTENT_LENGTH': '100'})
res = req.get_response(app) res = req.get_response(app)
self.assertEqual(res.status_int, 200) self.assertEqual(res.status_int, 200)
skipping to change at line 208 skipping to change at line 208
cache = FakeCache({'bytes': 0, 'meta': {'quota-bytes': '2'}}) cache = FakeCache({'bytes': 0, 'meta': {'quota-bytes': '2'}})
self.app.register('GET', '/v1/a/c2/o2', HTTPOk, self.app.register('GET', '/v1/a/c2/o2', HTTPOk,
{'Content-Length': '10'}, 'passed') {'Content-Length': '10'}, 'passed')
req = Request.blank('/v1/a/c2/o2', req = Request.blank('/v1/a/c2/o2',
environ={'REQUEST_METHOD': 'COPY', environ={'REQUEST_METHOD': 'COPY',
'swift.cache': cache}, 'swift.cache': cache},
headers={'Destination': '/c/o'}) headers={'Destination': '/c/o'})
res = req.get_response(self.copy_filter) res = req.get_response(self.copy_filter)
self.assertEqual(res.status_int, 413) self.assertEqual(res.status_int, 413)
self.assertEqual(res.body, 'Upload exceeds quota.') self.assertEqual(res.body, b'Upload exceeds quota.')
def test_not_exceed_bytes_quota_copy_verb(self): def test_not_exceed_bytes_quota_copy_verb(self):
self.app.register('GET', '/v1/a/c2/o2', HTTPOk, self.app.register('GET', '/v1/a/c2/o2', HTTPOk,
{'Content-Length': '10'}, 'passed') {'Content-Length': '10'}, 'passed')
self.app.register( self.app.register(
'PUT', '/v1/a/c/o', HTTPOk, {}, 'passed') 'PUT', '/v1/a/c/o', HTTPOk, {}, 'passed')
cache = FakeCache({'bytes': 0, 'meta': {'quota-bytes': '100'}}) cache = FakeCache({'bytes': 0, 'meta': {'quota-bytes': '100'}})
req = Request.blank('/v1/a/c2/o2', req = Request.blank('/v1/a/c2/o2',
environ={'REQUEST_METHOD': 'COPY', environ={'REQUEST_METHOD': 'COPY',
'swift.cache': cache}, 'swift.cache': cache},
skipping to change at line 232 skipping to change at line 232
def test_exceed_counts_quota_copy_verb(self): def test_exceed_counts_quota_copy_verb(self):
self.app.register('GET', '/v1/a/c2/o2', HTTPOk, {}, 'passed') self.app.register('GET', '/v1/a/c2/o2', HTTPOk, {}, 'passed')
cache = FakeCache({'object_count': 1, 'meta': {'quota-count': '1'}}) cache = FakeCache({'object_count': 1, 'meta': {'quota-count': '1'}})
req = Request.blank('/v1/a/c2/o2', req = Request.blank('/v1/a/c2/o2',
environ={'REQUEST_METHOD': 'COPY', environ={'REQUEST_METHOD': 'COPY',
'swift.cache': cache}, 'swift.cache': cache},
headers={'Destination': '/c/o'}) headers={'Destination': '/c/o'})
res = req.get_response(self.copy_filter) res = req.get_response(self.copy_filter)
self.assertEqual(res.status_int, 413) self.assertEqual(res.status_int, 413)
self.assertEqual(res.body, 'Upload exceeds quota.') self.assertEqual(res.body, b'Upload exceeds quota.')
def test_exceed_counts_quota_copy_cross_account_verb(self): def test_exceed_counts_quota_copy_cross_account_verb(self):
self.app.register('GET', '/v1/a/c2/o2', HTTPOk, {}, 'passed') self.app.register('GET', '/v1/a/c2/o2', HTTPOk, {}, 'passed')
a_c_cache = {'storage_policy': '0', 'meta': {'quota-count': '2'}, a_c_cache = {'storage_policy': '0', 'meta': {'quota-count': '2'},
'status': 200, 'object_count': 1} 'status': 200, 'object_count': 1}
a2_c_cache = {'storage_policy': '0', 'meta': {'quota-count': '1'}, a2_c_cache = {'storage_policy': '0', 'meta': {'quota-count': '1'},
'status': 200, 'object_count': 1} 'status': 200, 'object_count': 1}
req = Request.blank('/v1/a/c2/o2', req = Request.blank('/v1/a/c2/o2',
environ={'REQUEST_METHOD': 'COPY', environ={'REQUEST_METHOD': 'COPY',
'swift.infocache': { 'swift.infocache': {
'container/a/c': a_c_cache, 'container/a/c': a_c_cache,
'container/a2/c': a2_c_cache}}, 'container/a2/c': a2_c_cache}},
headers={'Destination': '/c/o', headers={'Destination': '/c/o',
'Destination-Account': 'a2'}) 'Destination-Account': 'a2'})
res = req.get_response(self.copy_filter) res = req.get_response(self.copy_filter)
self.assertEqual(res.status_int, 413) self.assertEqual(res.status_int, 413)
self.assertEqual(res.body, 'Upload exceeds quota.') self.assertEqual(res.body, b'Upload exceeds quota.')
def test_exceed_counts_quota_copy_cross_account_PUT_verb(self): def test_exceed_counts_quota_copy_cross_account_PUT_verb(self):
self.app.register('GET', '/v1/a/c2/o2', HTTPOk, {}, 'passed') self.app.register('GET', '/v1/a/c2/o2', HTTPOk, {}, 'passed')
a_c_cache = {'storage_policy': '0', 'meta': {'quota-count': '2'}, a_c_cache = {'storage_policy': '0', 'meta': {'quota-count': '2'},
'status': 200, 'object_count': 1} 'status': 200, 'object_count': 1}
a2_c_cache = {'storage_policy': '0', 'meta': {'quota-count': '1'}, a2_c_cache = {'storage_policy': '0', 'meta': {'quota-count': '1'},
'status': 200, 'object_count': 1} 'status': 200, 'object_count': 1}
req = Request.blank('/v1/a2/c/o', req = Request.blank('/v1/a2/c/o',
environ={'REQUEST_METHOD': 'PUT', environ={'REQUEST_METHOD': 'PUT',
'swift.infocache': { 'swift.infocache': {
'container/a/c': a_c_cache, 'container/a/c': a_c_cache,
'container/a2/c': a2_c_cache}}, 'container/a2/c': a2_c_cache}},
headers={'X-Copy-From': '/c2/o2', headers={'X-Copy-From': '/c2/o2',
'X-Copy-From-Account': 'a'}) 'X-Copy-From-Account': 'a'})
res = req.get_response(self.copy_filter) res = req.get_response(self.copy_filter)
self.assertEqual(res.status_int, 413) self.assertEqual(res.status_int, 413)
self.assertEqual(res.body, 'Upload exceeds quota.') self.assertEqual(res.body, b'Upload exceeds quota.')
def test_exceed_bytes_quota_copy_from(self): def test_exceed_bytes_quota_copy_from(self):
self.app.register('GET', '/v1/a/c2/o2', HTTPOk, self.app.register('GET', '/v1/a/c2/o2', HTTPOk,
{'Content-Length': '10'}, 'passed') {'Content-Length': '10'}, 'passed')
cache = FakeCache({'bytes': 0, 'meta': {'quota-bytes': '2'}}) cache = FakeCache({'bytes': 0, 'meta': {'quota-bytes': '2'}})
req = Request.blank('/v1/a/c/o', req = Request.blank('/v1/a/c/o',
environ={'REQUEST_METHOD': 'PUT', environ={'REQUEST_METHOD': 'PUT',
'swift.cache': cache}, 'swift.cache': cache},
headers={'x-copy-from': '/c2/o2'}) headers={'x-copy-from': '/c2/o2'})
res = req.get_response(self.copy_filter) res = req.get_response(self.copy_filter)
self.assertEqual(res.status_int, 413) self.assertEqual(res.status_int, 413)
self.assertEqual(res.body, 'Upload exceeds quota.') self.assertEqual(res.body, b'Upload exceeds quota.')
def test_not_exceed_bytes_quota_copy_from(self): def test_not_exceed_bytes_quota_copy_from(self):
self.app.register('GET', '/v1/a/c2/o2', HTTPOk, self.app.register('GET', '/v1/a/c2/o2', HTTPOk,
{'Content-Length': '10'}, 'passed') {'Content-Length': '10'}, 'passed')
self.app.register( self.app.register(
'PUT', '/v1/a/c/o', HTTPOk, {}, 'passed') 'PUT', '/v1/a/c/o', HTTPOk, {}, 'passed')
cache = FakeCache({'bytes': 0, 'meta': {'quota-bytes': '100'}}) cache = FakeCache({'bytes': 0, 'meta': {'quota-bytes': '100'}})
req = Request.blank('/v1/a/c/o', req = Request.blank('/v1/a/c/o',
environ={'REQUEST_METHOD': 'PUT', environ={'REQUEST_METHOD': 'PUT',
'swift.cache': cache}, 'swift.cache': cache},
skipping to change at line 325 skipping to change at line 325
def test_exceed_counts_quota_copy_from(self): def test_exceed_counts_quota_copy_from(self):
self.app.register('GET', '/v1/a/c2/o2', HTTPOk, self.app.register('GET', '/v1/a/c2/o2', HTTPOk,
{'Content-Length': '10'}, 'passed') {'Content-Length': '10'}, 'passed')
cache = FakeCache({'object_count': 1, 'meta': {'quota-count': '1'}}) cache = FakeCache({'object_count': 1, 'meta': {'quota-count': '1'}})
req = Request.blank('/v1/a/c/o', req = Request.blank('/v1/a/c/o',
environ={'REQUEST_METHOD': 'PUT', environ={'REQUEST_METHOD': 'PUT',
'swift.cache': cache}, 'swift.cache': cache},
headers={'x-copy-from': '/c2/o2'}) headers={'x-copy-from': '/c2/o2'})
res = req.get_response(self.copy_filter) res = req.get_response(self.copy_filter)
self.assertEqual(res.status_int, 413) self.assertEqual(res.status_int, 413)
self.assertEqual(res.body, 'Upload exceeds quota.') self.assertEqual(res.body, b'Upload exceeds quota.')
def test_not_exceed_counts_quota_copy_from(self): def test_not_exceed_counts_quota_copy_from(self):
self.app.register('GET', '/v1/a/c2/o2', HTTPOk, self.app.register('GET', '/v1/a/c2/o2', HTTPOk,
{'Content-Length': '10'}, 'passed') {'Content-Length': '10'}, 'passed')
self.app.register( self.app.register(
'PUT', '/v1/a/c/o', HTTPOk, {}, 'passed') 'PUT', '/v1/a/c/o', HTTPOk, {}, 'passed')
cache = FakeCache({'object_count': 1, 'meta': {'quota-count': '2'}}) cache = FakeCache({'object_count': 1, 'meta': {'quota-count': '2'}})
req = Request.blank('/v1/a/c/o', req = Request.blank('/v1/a/c/o',
environ={'REQUEST_METHOD': 'PUT', environ={'REQUEST_METHOD': 'PUT',
'swift.cache': cache}, 'swift.cache': cache},
 End of changes. 8 change blocks. 
8 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)