当前位置: 首页>>代码示例>>Python>>正文


Python RestConnection.get_bucket_maxTTL方法代码示例

本文整理汇总了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")
开发者ID:arod1987,项目名称:testrunner,代码行数:54,代码来源:expiry_maxttl.py


注:本文中的lib.membase.api.rest_client.RestConnection.get_bucket_maxTTL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。