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


Python arctic.ArcticLibraryBinding类代码示例

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


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

示例1: test_check_quota_Zero2

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,代码行数:7,代码来源:test_arctic.py

示例2: test_check_quota_Zero2

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,代码行数:7,代码来源:test_arctic.py

示例3: test_check_quota_exceeded

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,代码行数:11,代码来源:test_arctic.py

示例4: test_check_quota_exceeded

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,代码行数:13,代码来源:test_arctic.py

示例5: test_check_quota_info

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,代码行数:13,代码来源:test_arctic.py

示例6: test_check_quota_90_percent

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,代码行数:15,代码来源:test_arctic.py

示例7: test_check_quota

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,代码行数:15,代码来源:test_arctic.py

示例8: test_check_quota_info

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,代码行数:15,代码来源:test_arctic.py

示例9: test_check_quota_countdown

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,代码行数:6,代码来源:test_arctic.py

示例10: test_get_quota

def test_get_quota():
    m = Mock(spec=ArcticLibraryBinding)
    m.get_library_metadata.return_value = 42
    assert ArcticLibraryBinding.get_quota(m) == 42
    m.get_library_metadata.assert_called_once_with('QUOTA')
开发者ID:manahl,项目名称:arctic,代码行数:5,代码来源:test_arctic.py

示例11: test_set_quota

def test_set_quota():
    m = Mock(spec=ArcticLibraryBinding)
    ArcticLibraryBinding.set_quota(m, 10000)
    m.set_library_metadata.assert_called_once_with('QUOTA', 10000)
    assert m.quota_countdown == 0
    assert m.quota == 10000
开发者ID:manahl,项目名称:arctic,代码行数:6,代码来源:test_arctic.py

示例12: test_check_quota_countdown

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,代码行数:6,代码来源:test_arctic.py

示例13: test_check_quota_Zero

def test_check_quota_Zero():
    self = create_autospec(ArcticLibraryBinding)
    self.quota = 0
    ArcticLibraryBinding.check_quota(self)
开发者ID:rsheftel,项目名称:arctic,代码行数:4,代码来源:test_arctic.py

示例14: test_get_quota

def test_get_quota():
    self = create_autospec(ArcticLibraryBinding)
    self.get_library_metadata.return_value = 42
    assert ArcticLibraryBinding.get_quota(self) == 42
    self.get_library_metadata.assert_called_once_with('QUOTA')
开发者ID:rsheftel,项目名称:arctic,代码行数:5,代码来源:test_arctic.py

示例15: test_set_quota

def test_set_quota():
    self = create_autospec(ArcticLibraryBinding)
    ArcticLibraryBinding.set_quota(self, 10000)
    self.set_library_metadata.assert_called_once_with('QUOTA', 10000)
    assert self.quota_countdown == 0
    assert self.quota == 10000
开发者ID:rsheftel,项目名称:arctic,代码行数:6,代码来源:test_arctic.py


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