Skip to content
Browse files

Bug 727780 - Have /info/quota return object with named keys; r=telliott

Previously it just returned a list of values, which is not
very self-documenting or future-proof.
  • Loading branch information...
1 parent 5c14bcc commit 075d4b63b9fd372660f736e04209350efd504808 @rfk rfk committed Feb 16, 2012
Showing with 6 additions and 3 deletions.
  1. +4 −1 syncstorage/controller.py
  2. +2 −2 syncstorage/tests/functional/test_storage.py
View
5 syncstorage/controller.py
@@ -107,7 +107,10 @@ def get_quota(self, request):
limit = None
else:
limit = self._get_storage(request).quota_size
- return used, limit
+ return {
+ "usage": used,
+ "quota": limit,
+ }
def get_collection_usage(self, request):
user_id = request.user['userid']
View
4 syncstorage/tests/functional/test_storage.py
@@ -562,11 +562,11 @@ def test_ifunmodifiedsince(self):
def test_quota(self):
res = self.app.get(self.root + '/info/quota')
- old_used, quota = res.json
+ old_used = res.json["usage"]
bso = {'payload': _PLD}
self.app.put_json(self.root + '/storage/col2/12345', bso)
res = self.app.get(self.root + '/info/quota')
- used, quota = res.json
+ used = res.json["usage"]
self.assertEquals(used - old_used, len(_PLD) / 1024.)
def test_overquota(self):

0 comments on commit 075d4b6

Please sign in to comment.
Something went wrong with that request. Please try again.