Set int type on several container headers
Several header values for counts and sizes were returning strings. They are now created with type=int in their respective resource.header. Change-Id: Ie84343381da6772491a245ae69a07be4477ff3f7
This commit is contained in:
@@ -31,11 +31,12 @@ class Container(resource.Resource):
|
|||||||
# Account data (when id=None)
|
# Account data (when id=None)
|
||||||
#: The total number of bytes that are stored in Object Storage for
|
#: The total number of bytes that are stored in Object Storage for
|
||||||
#: the account.
|
#: the account.
|
||||||
account_bytes_used = resource.header("x-account-bytes-used")
|
account_bytes_used = resource.header("x-account-bytes-used", type=int)
|
||||||
#: The number of containers.
|
#: The number of containers.
|
||||||
account_container_count = resource.header("x-account-container-count")
|
account_container_count = resource.header("x-account-container-count",
|
||||||
|
type=int)
|
||||||
#: The number of objects in the account.
|
#: The number of objects in the account.
|
||||||
account_object_count = resource.header("x-account-object-count")
|
account_object_count = resource.header("x-account-object-count", type=int)
|
||||||
#: The secret key value for temporary URLs. If not set,
|
#: The secret key value for temporary URLs. If not set,
|
||||||
#: this header is not returned by this operation.
|
#: this header is not returned by this operation.
|
||||||
meta_temp_url_key = resource.header("x-account-meta-temp-url-key")
|
meta_temp_url_key = resource.header("x-account-meta-temp-url-key")
|
||||||
@@ -54,9 +55,9 @@ class Container(resource.Resource):
|
|||||||
|
|
||||||
# Container metadata (when id=name)
|
# Container metadata (when id=name)
|
||||||
#: The number of objects.
|
#: The number of objects.
|
||||||
object_count = resource.header("x-container-object-count")
|
object_count = resource.header("x-container-object-count", type=int)
|
||||||
#: The count of bytes used in total.
|
#: The count of bytes used in total.
|
||||||
bytes_used = resource.header("x-container-bytes-used")
|
bytes_used = resource.header("x-container-bytes-used", type=int)
|
||||||
|
|
||||||
# Request headers (when id=None)
|
# Request headers (when id=None)
|
||||||
#: If set to True, Object Storage queries all replicas to return the
|
#: If set to True, Object Storage queries all replicas to return the
|
||||||
|
|||||||
@@ -69,11 +69,11 @@ class TestAccount(testtools.TestCase):
|
|||||||
def test_make_it(self):
|
def test_make_it(self):
|
||||||
sot = container.Container.new(**{'headers': ACCOUNT_EXAMPLE})
|
sot = container.Container.new(**{'headers': ACCOUNT_EXAMPLE})
|
||||||
self.assertIsNone(sot.id)
|
self.assertIsNone(sot.id)
|
||||||
self.assertEqual(ACCOUNT_EXAMPLE['x-account-bytes-used'],
|
self.assertEqual(int(ACCOUNT_EXAMPLE['x-account-bytes-used']),
|
||||||
sot.account_bytes_used)
|
sot.account_bytes_used)
|
||||||
self.assertEqual(ACCOUNT_EXAMPLE['x-account-container-count'],
|
self.assertEqual(int(ACCOUNT_EXAMPLE['x-account-container-count']),
|
||||||
sot.account_container_count)
|
sot.account_container_count)
|
||||||
self.assertEqual(ACCOUNT_EXAMPLE['x-account-object-count'],
|
self.assertEqual(int(ACCOUNT_EXAMPLE['x-account-object-count']),
|
||||||
sot.account_object_count)
|
sot.account_object_count)
|
||||||
|
|
||||||
|
|
||||||
@@ -123,9 +123,9 @@ class TestContainer(testtools.TestCase):
|
|||||||
self.assertEqual(CONT_EXAMPLE['bytes'], sot.bytes)
|
self.assertEqual(CONT_EXAMPLE['bytes'], sot.bytes)
|
||||||
|
|
||||||
# Attributes from header
|
# Attributes from header
|
||||||
self.assertEqual(HEAD_EXAMPLE['x-container-object-count'],
|
self.assertEqual(int(HEAD_EXAMPLE['x-container-object-count']),
|
||||||
sot.object_count)
|
sot.object_count)
|
||||||
self.assertEqual(HEAD_EXAMPLE['x-container-bytes-used'],
|
self.assertEqual(int(HEAD_EXAMPLE['x-container-bytes-used']),
|
||||||
sot.bytes_used)
|
sot.bytes_used)
|
||||||
self.assertEqual(HEAD_EXAMPLE['x-container-read'],
|
self.assertEqual(HEAD_EXAMPLE['x-container-read'],
|
||||||
sot.read_ACL)
|
sot.read_ACL)
|
||||||
|
|||||||
Reference in New Issue
Block a user