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


Python ArcticLibraryBinding.check_quota方法代码示例

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


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

示例1: test_check_quota_Zero2

# 需要导入模块: from arctic.arctic import ArcticLibraryBinding [as 别名]
# 或者: from arctic.arctic.ArcticLibraryBinding import check_quota [as 别名]
def test_check_quota_Zero2():
    m = Mock(spec=ArcticLibraryBinding)
    m.quota = None
    m.get_library_metadata.return_value = 0
    ArcticLibraryBinding.check_quota(m)
    m.get_library_metadata.assert_called_once_with('QUOTA')
    assert m.quota == 0
开发者ID:JianfengYu,项目名称:arctic,代码行数:9,代码来源:test_arctic.py

示例2: test_check_quota_Zero2

# 需要导入模块: from arctic.arctic import ArcticLibraryBinding [as 别名]
# 或者: from arctic.arctic.ArcticLibraryBinding import check_quota [as 别名]
def test_check_quota_Zero2():
    self = create_autospec(ArcticLibraryBinding)
    self.quota = None
    self.get_library_metadata.return_value = 0
    ArcticLibraryBinding.check_quota(self)
    self.get_library_metadata.assert_called_once_with('QUOTA')
    assert self.quota == 0
开发者ID:rsheftel,项目名称:arctic,代码行数:9,代码来源:test_arctic.py

示例3: test_check_quota_exceeded

# 需要导入模块: from arctic.arctic import ArcticLibraryBinding [as 别名]
# 或者: from arctic.arctic.ArcticLibraryBinding import check_quota [as 别名]
def test_check_quota_exceeded():
    self = create_autospec(ArcticLibraryBinding)
    self.arctic = create_autospec(Arctic)
    self.quota = 1024 * 1024 * 1024
    self.quota_countdown = 0
    self.arctic.__getitem__.return_value = Mock(
        stats=Mock(return_value={"totals": {"size": 1024 * 1024 * 1024, "count": 100}})
    )
    with pytest.raises(QuotaExceededException) as e:
        ArcticLibraryBinding.check_quota(self)
    assert "Quota Exceeded: 1.000 / 1 GB used" in str(e)
开发者ID:keepsimpler,项目名称:arctic,代码行数:13,代码来源:test_arctic.py

示例4: test_check_quota_exceeded

# 需要导入模块: from arctic.arctic import ArcticLibraryBinding [as 别名]
# 或者: from arctic.arctic.ArcticLibraryBinding import check_quota [as 别名]
def test_check_quota_exceeded():
    self = create_autospec(ArcticLibraryBinding)
    self.arctic = create_autospec(Arctic)
    self.get_library_metadata.return_value = 1024 * 1024 * 1024
    self.quota_countdown = 0
    self.arctic.__getitem__.return_value = Mock(stats=Mock(return_value={'totals':
                                                                             {'size': 1024 * 1024 * 1024,
                                                                              'count': 100,
                                                                              }
                                                                             }))
    with pytest.raises(QuotaExceededException) as e:
        ArcticLibraryBinding.check_quota(self)
    assert "Quota Exceeded: 1.000 / 1 GB used" in str(e)
开发者ID:calsaviour,项目名称:arctic,代码行数:15,代码来源:test_arctic.py

示例5: test_check_quota_info

# 需要导入模块: from arctic.arctic import ArcticLibraryBinding [as 别名]
# 或者: from arctic.arctic.ArcticLibraryBinding import check_quota [as 别名]
def test_check_quota_info():
    self = create_autospec(ArcticLibraryBinding)
    self.arctic = create_autospec(Arctic)
    self.quota = 1024 * 1024 * 1024
    self.quota_countdown = 0
    self.arctic.__getitem__.return_value = Mock(
        stats=Mock(return_value={"totals": {"size": 1 * 1024 * 1024, "count": 100}})
    )
    with patch("arctic.arctic.logger.info") as info:
        ArcticLibraryBinding.check_quota(self)
    self.arctic.__getitem__.assert_called_once_with(self.get_name.return_value)
    info.assert_called_once_with("Mongo Quota: 0.001 / 1 GB used")
    assert self.quota_countdown == 51153
开发者ID:keepsimpler,项目名称:arctic,代码行数:15,代码来源:test_arctic.py

示例6: test_check_quota_90_percent

# 需要导入模块: from arctic.arctic import ArcticLibraryBinding [as 别名]
# 或者: from arctic.arctic.ArcticLibraryBinding import check_quota [as 别名]
def test_check_quota_90_percent():
    self = create_autospec(ArcticLibraryBinding, database_name='arctic_db',
                           library='lib')
    self.arctic = create_autospec(Arctic)
    self.get_library_metadata.return_value = 1024 * 1024 * 1024
    self.quota_countdown = 0
    self.arctic.__getitem__.return_value = Mock(stats=Mock(return_value={'totals':
                                                                             {'size': 0.91 * 1024 * 1024 * 1024,
                                                                              'count': 1000000,
                                                                              }
                                                                             }))
    with patch('arctic.arctic.logger.warning') as warn:
        ArcticLibraryBinding.check_quota(self)
    self.arctic.__getitem__.assert_called_once_with(self.get_name.return_value)
    warn.assert_called_once_with('Mongo Quota: arctic_db.lib 0.910 / 1 GB used')
开发者ID:manahl,项目名称:arctic,代码行数:17,代码来源:test_arctic.py

示例7: test_check_quota

# 需要导入模块: from arctic.arctic import ArcticLibraryBinding [as 别名]
# 或者: from arctic.arctic.ArcticLibraryBinding import check_quota [as 别名]
def test_check_quota():
    self = create_autospec(ArcticLibraryBinding)
    self.arctic = create_autospec(Arctic)
    self.quota = 1024 * 1024 * 1024
    self.quota_countdown = 0
    self.arctic.__getitem__.return_value = Mock(stats=Mock(return_value={'totals':
                                                                             {'size': 900 * 1024 * 1024,
                                                                              'count': 100,
                                                                              }
                                                                             }))
    with patch('arctic.arctic.logger.warn') as warn:
        ArcticLibraryBinding.check_quota(self)
    self.arctic.__getitem__.assert_called_once_with(self.get_name.return_value)
    warn.assert_called_once_with('Mongo Quota: 0.879 / 1 GB used')
    assert self.quota_countdown == 6
开发者ID:rsheftel,项目名称:arctic,代码行数:17,代码来源:test_arctic.py

示例8: test_check_quota_info

# 需要导入模块: from arctic.arctic import ArcticLibraryBinding [as 别名]
# 或者: from arctic.arctic.ArcticLibraryBinding import check_quota [as 别名]
def test_check_quota_info():
    self = create_autospec(ArcticLibraryBinding)
    self.arctic = create_autospec(Arctic)
    self.get_library_metadata.return_value = 1024 * 1024 * 1024
    self.quota_countdown = 0
    self.arctic.__getitem__.return_value = Mock(stats=Mock(return_value={'totals':
                                                                             {'size': 1 * 1024 * 1024,
                                                                              'count': 100,
                                                                              }
                                                                             }))
    with patch('arctic.arctic.logger.info') as info:
        ArcticLibraryBinding.check_quota(self)
    self.arctic.__getitem__.assert_called_once_with(self.get_name.return_value)
    info.assert_called_once_with('Mongo Quota: 0.001 / 1 GB used')
    assert self.quota_countdown == 51153
开发者ID:calsaviour,项目名称:arctic,代码行数:17,代码来源:test_arctic.py

示例9: test_check_quota_countdown

# 需要导入模块: from arctic.arctic import ArcticLibraryBinding [as 别名]
# 或者: from arctic.arctic.ArcticLibraryBinding import check_quota [as 别名]
def test_check_quota_countdown():
    self = create_autospec(ArcticLibraryBinding)
    self.get_library_metadata.return_value = 10
    self.quota_countdown = 10
    ArcticLibraryBinding.check_quota(self)
    assert self.quota_countdown == 9
开发者ID:manahl,项目名称:arctic,代码行数:8,代码来源:test_arctic.py

示例10: test_check_quota_countdown

# 需要导入模块: from arctic.arctic import ArcticLibraryBinding [as 别名]
# 或者: from arctic.arctic.ArcticLibraryBinding import check_quota [as 别名]
def test_check_quota_countdown():
    self = create_autospec(ArcticLibraryBinding)
    self.quota = 10
    self.quota_countdown = 10
    ArcticLibraryBinding.check_quota(self)
    assert self.quota_countdown == 9
开发者ID:rsheftel,项目名称:arctic,代码行数:8,代码来源:test_arctic.py

示例11: test_check_quota_Zero

# 需要导入模块: from arctic.arctic import ArcticLibraryBinding [as 别名]
# 或者: from arctic.arctic.ArcticLibraryBinding import check_quota [as 别名]
def test_check_quota_Zero():
    self = create_autospec(ArcticLibraryBinding)
    self.quota = 0
    ArcticLibraryBinding.check_quota(self)
开发者ID:rsheftel,项目名称:arctic,代码行数:6,代码来源:test_arctic.py


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