本文整理汇总了Python中lib.membase.api.rest_client.RestConnection.get_bucket_maxTTL方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.get_bucket_maxTTL方法的具体用法?Python RestConnection.get_bucket_maxTTL怎么用?Python RestConnection.get_bucket_maxTTL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.membase.api.rest_client.RestConnection
的用法示例。
在下文中一共展示了RestConnection.get_bucket_maxTTL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_maxttl_possible_values
# 需要导入模块: from lib.membase.api.rest_client import RestConnection [as 别名]
# 或者: from lib.membase.api.rest_client.RestConnection import get_bucket_maxTTL [as 别名]
def test_maxttl_possible_values(self):
"""
Test
1. min - 0
2. max - 2147483647q
3. default - 0
4. negative values, date, string
"""
# default
rest = RestConnection(self.master)
default_maxttl = rest.get_bucket_maxTTL()
if default_maxttl != 0:
self.fail("FAIL: default maxTTL if left unset must be 0 but is {0}".format(default_maxttl))
self.log.info("Verified: default maxTTL if left unset is {0}".format(default_maxttl))
# max value
try:
self._update_bucket_maxTTL(maxttl=2147483648)
except Exception as e:
self.log.info("Expected exception : {0}".format(e))
try:
self._update_bucket_maxTTL(maxttl=2147483647)
except Exception as e:
self.fail("Unable to set maxTTL=2147483647, the max permitted value")
else:
self.log.info("Verified: Max value permitted is 2147483647")
else:
self.fail("Able to set maxTTL greater than 2147483647")
# min value
try:
self._update_bucket_maxTTL(maxttl=0)
except Exception as e:
self.fail("Unable to set maxTTL=0, the min permitted value")
else:
self.log.info("Verified: Min value permitted is 0")
# negative value
try:
self._update_bucket_maxTTL(maxttl=-60)
except Exception as e:
self.log.info("Verified: negative values not permitted, exception : {0}".format(e))
else:
self.fail("FAIL: Able to set a negative maxTTL")
# date/string
try:
self._update_bucket_maxTTL(maxttl="12/23/2016")
except Exception as e:
self.log.info("Verified: string not permitted, exception : {0}".format(e))
else:
self.fail("FAIL: Able to set a date string maxTTL")