Patch policies for more per-policy quota tests
Related-Change: Ib25c2f667e5b81301f8c67375644981a13487cfe Change-Id: I1cc32bfe607454c6756f08ed9d95ac027369e638
This commit is contained in:
parent
629516cbe7
commit
0dff2cae9f
@ -382,13 +382,14 @@ class TestAccountQuota(unittest.TestCase):
|
||||
self.assertEqual(res.status_int, 400)
|
||||
self.assertEqual(self.app.calls, [])
|
||||
|
||||
@patch_policies
|
||||
def test_invalid_policy_quota(self):
|
||||
app = account_quotas.AccountQuotaMiddleware(self.app)
|
||||
cache = FakeCache(None)
|
||||
req = Request.blank('/v1/a', environ={
|
||||
'REQUEST_METHOD': 'POST',
|
||||
'swift.cache': cache,
|
||||
'HTTP_X_ACCOUNT_QUOTA_BYTES_POLICY_POLICY_0': 'abc',
|
||||
'HTTP_X_ACCOUNT_QUOTA_BYTES_POLICY_NULO': 'abc',
|
||||
'reseller_request': True})
|
||||
res = req.get_response(app)
|
||||
self.assertEqual(res.status_int, 400)
|
||||
@ -405,13 +406,14 @@ class TestAccountQuota(unittest.TestCase):
|
||||
self.assertEqual(res.status_int, 403)
|
||||
self.assertEqual(self.app.calls, [])
|
||||
|
||||
@patch_policies
|
||||
def test_valid_policy_quota_admin(self):
|
||||
app = account_quotas.AccountQuotaMiddleware(self.app)
|
||||
cache = FakeCache(None)
|
||||
req = Request.blank('/v1/a', environ={
|
||||
'REQUEST_METHOD': 'POST',
|
||||
'swift.cache': cache,
|
||||
'HTTP_X_ACCOUNT_QUOTA_BYTES_POLICY_POLICY_0': '100'})
|
||||
'HTTP_X_ACCOUNT_QUOTA_BYTES_POLICY_UNU': '100'})
|
||||
res = req.get_response(app)
|
||||
self.assertEqual(res.status_int, 403)
|
||||
self.assertEqual(self.app.calls, [])
|
||||
@ -430,13 +432,14 @@ class TestAccountQuota(unittest.TestCase):
|
||||
('POST', '/v1/a', {'Host': 'localhost:80',
|
||||
'X-Account-Meta-Quota-Bytes': '100'})])
|
||||
|
||||
@patch_policies
|
||||
def test_valid_policy_quota_reseller(self):
|
||||
app = account_quotas.AccountQuotaMiddleware(self.app)
|
||||
cache = FakeCache(None)
|
||||
req = Request.blank('/v1/a', environ={
|
||||
'REQUEST_METHOD': 'POST',
|
||||
'swift.cache': cache,
|
||||
'HTTP_X_ACCOUNT_QUOTA_BYTES_POLICY_POLICY_0': '100',
|
||||
'HTTP_X_ACCOUNT_QUOTA_BYTES_POLICY_NULO': '100',
|
||||
'reseller_request': True})
|
||||
res = req.get_response(app)
|
||||
self.assertEqual(res.status_int, 200)
|
||||
|
Loading…
Reference in New Issue
Block a user