base.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:eclsdk 作者: nttcom 项目源码 文件源码
def service_exists(**kwargs):
    """Decorator function to check whether a service exists

    Usage:
    @unittest.skipUnless(base.service_exists(service_type="metering"),
                         "Metering service does not exist")
    class TestMeter(base.BaseFunctionalTest):
        ...

    :param kwargs: The kwargs needed to filter an endpoint.
    :returns: True if the service exists, otherwise False.
    """
    try:
        conn = connection.from_config(cloud_name=TEST_CLOUD)
        conn.session.get_endpoint(**kwargs)

        return True
    except _exceptions.EndpointNotFound:
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号