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


Python AwsLimit._current_usage方法代码示例

本文整理汇总了Python中awslimitchecker.limit.AwsLimit._current_usage方法的典型用法代码示例。如果您正苦于以下问题:Python AwsLimit._current_usage方法的具体用法?Python AwsLimit._current_usage怎么用?Python AwsLimit._current_usage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在awslimitchecker.limit.AwsLimit的用法示例。


在下文中一共展示了AwsLimit._current_usage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_current_usage

# 需要导入模块: from awslimitchecker.limit import AwsLimit [as 别名]
# 或者: from awslimitchecker.limit.AwsLimit import _current_usage [as 别名]
 def test_get_current_usage(self):
     limit = AwsLimit(
         'limitname',
         self.mock_svc,
         3,
         1,
         2
     )
     limit._current_usage = 2
     assert limit.get_current_usage() == 2
开发者ID:bflad,项目名称:awslimitchecker,代码行数:12,代码来源:test_limit.py

示例2: test_check_thresholds_pct_warn_crit

# 需要导入模块: from awslimitchecker.limit import AwsLimit [as 别名]
# 或者: from awslimitchecker.limit.AwsLimit import _current_usage [as 别名]
 def test_check_thresholds_pct_warn_crit(self):
     limit = AwsLimit('limitname', self.mock_svc, 100, 1, 2)
     u1 = AwsLimitUsage(limit, 50, resource_id='foo4bar')
     u2 = AwsLimitUsage(limit, 3, resource_id='foo3bar')
     u3 = AwsLimitUsage(limit, 95, resource_id='foo2bar')
     limit._current_usage = [u1, u2, u3]
     with patch('awslimitchecker.limit.AwsLimit.'
                '_get_thresholds') as mock_get_thresh:
         with patch('awslimitchecker.limit.AwsLimit.get_'
                    'limit') as mock_get_limit:
             mock_get_thresh.return_value = (None, 40, None, 80)
             mock_get_limit.return_value = 100
             res = limit.check_thresholds()
     assert res is False
     assert limit._warnings == [u1]
     assert limit._criticals == [u3]
     assert mock_get_thresh.mock_calls == [call()]
     assert mock_get_limit.mock_calls == [call()]
开发者ID:bflad,项目名称:awslimitchecker,代码行数:20,代码来源:test_limit.py

示例3: test_check_thresholds_ta_unlimited

# 需要导入模块: from awslimitchecker.limit import AwsLimit [as 别名]
# 或者: from awslimitchecker.limit.AwsLimit import _current_usage [as 别名]
 def test_check_thresholds_ta_unlimited(self):
     limit = AwsLimit('limitname', self.mock_svc, 3, 1, 2)
     u1 = AwsLimitUsage(limit, 4, resource_id='foo4bar')
     u2 = AwsLimitUsage(limit, 3, resource_id='foo3bar')
     u3 = AwsLimitUsage(limit, 2, resource_id='foo2bar')
     limit._current_usage = [u1, u2, u3]
     limit._set_ta_unlimited()
     with patch('awslimitchecker.limit.AwsLimit.'
                '_get_thresholds') as mock_get_thresh:
         with patch('awslimitchecker.limit.AwsLimit.get_'
                    'limit') as mock_get_limit:
             mock_get_thresh.return_value = (None, 40, None, 80)
             mock_get_limit.return_value = None
             res = limit.check_thresholds()
     assert res is True
     assert limit._warnings == []
     assert limit._criticals == []
     assert mock_get_thresh.mock_calls == []
     assert mock_get_limit.mock_calls == [call()]
开发者ID:bflad,项目名称:awslimitchecker,代码行数:21,代码来源:test_limit.py


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