本文整理汇总了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
示例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
示例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)
示例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)
示例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
示例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')
示例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
示例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
示例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
示例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
示例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)