本文整理汇总了Python中socorrolib.lib.util.DotDict.legacy_processing方法的典型用法代码示例。如果您正苦于以下问题:Python DotDict.legacy_processing方法的具体用法?Python DotDict.legacy_processing怎么用?Python DotDict.legacy_processing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类socorrolib.lib.util.DotDict
的用法示例。
在下文中一共展示了DotDict.legacy_processing方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_save_raw_crash_no_legacy
# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import legacy_processing [as 别名]
def test_save_raw_crash_no_legacy(self):
config = self._setup_config()
config.filter_on_legacy_processing = False
crash_store = RabbitMQCrashStorage(config)
# test for "legacy_processing" missing from crash
crash_store.save_raw_crash(
raw_crash=DotDict(),
dumps=DotDict(),
crash_id='crash_id'
)
crash_store.transaction.assert_called_with(
crash_store._save_raw_crash_transaction,
'crash_id'
)
config.logger.reset_mock()
# test for normal save
raw_crash = DotDict()
raw_crash.legacy_processing = 0
crash_store.save_raw_crash(
raw_crash=raw_crash,
dumps=DotDict,
crash_id='crash_id'
)
crash_store.transaction.assert_called_with(
crash_store._save_raw_crash_transaction,
'crash_id'
)
crash_store.transaction.reset_mock()
# test for save without regard to "legacy_processing" value
raw_crash = DotDict()
raw_crash.legacy_processing = 5
crash_store.save_raw_crash(
raw_crash=raw_crash,
dumps=DotDict,
crash_id='crash_id'
)
crash_store.transaction.assert_called_with(
crash_store._save_raw_crash_transaction,
'crash_id'
)
示例2: test_save_raw_crash_normal
# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import legacy_processing [as 别名]
def test_save_raw_crash_normal(self):
config = self._setup_config()
crash_store = RabbitMQCrashStorage(config)
# test for "legacy_processing" missing from crash
crash_store.save_raw_crash(
raw_crash=DotDict(),
dumps=DotDict(),
crash_id='crash_id'
)
ok_(not crash_store.transaction.called)
config.logger.reset_mock()
# test for normal save
raw_crash = DotDict()
raw_crash.legacy_processing = 0
crash_store.save_raw_crash(
raw_crash=raw_crash,
dumps=DotDict,
crash_id='crash_id'
)
crash_store.transaction.assert_called_with(
crash_store._save_raw_crash_transaction,
'crash_id'
)
crash_store.transaction.reset_mock()
# test for save rejection because of "legacy_processing"
raw_crash = DotDict()
raw_crash.legacy_processing = 5
crash_store.save_raw_crash(
raw_crash=raw_crash,
dumps=DotDict,
crash_id='crash_id'
)
ok_(not crash_store.transaction.called)
示例3: test_save_raw_crash_normal_throttle
# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import legacy_processing [as 别名]
def test_save_raw_crash_normal_throttle(self, randint_mock):
random_ints = [100, 49, 50, 51, 1, 100]
def side_effect(*args, **kwargs):
return random_ints.pop(0)
randint_mock.side_effect = side_effect
config = self._setup_config()
config.throttle = 50
crash_store = RabbitMQCrashStorage(config)
# test for "legacy_processing" missing from crash #0: 100
crash_store.save_raw_crash(
raw_crash=DotDict(),
dumps=DotDict(),
crash_id='crash_id'
)
ok_(not crash_store.transaction.called)
config.logger.reset_mock()
# test for normal save #1: 49
raw_crash = DotDict()
raw_crash.legacy_processing = 0
crash_store.save_raw_crash(
raw_crash=raw_crash,
dumps=DotDict,
crash_id='crash_id'
)
crash_store.transaction.assert_called_with(
crash_store._save_raw_crash_transaction,
'crash_id'
)
crash_store.transaction.reset_mock()
# test for normal save #2: 50
raw_crash = DotDict()
raw_crash.legacy_processing = 0
crash_store.save_raw_crash(
raw_crash=raw_crash,
dumps=DotDict,
crash_id='crash_id'
)
crash_store.transaction.assert_called_with(
crash_store._save_raw_crash_transaction,
'crash_id'
)
crash_store.transaction.reset_mock()
# test for normal save #3: 51
raw_crash = DotDict()
raw_crash.legacy_processing = 0
crash_store.save_raw_crash(
raw_crash=raw_crash,
dumps=DotDict,
crash_id='crash_id'
)
ok_(not crash_store.transaction.called)
crash_store.transaction.reset_mock()
# test for save rejection because of "legacy_processing" #4: 1
raw_crash = DotDict()
raw_crash.legacy_processing = 5
crash_store.save_raw_crash(
raw_crash=raw_crash,
dumps=DotDict,
crash_id='crash_id'
)
ok_(not crash_store.transaction.called)
# test for save rejection because of "legacy_processing" #5: 100
raw_crash = DotDict()
raw_crash.legacy_processing = 5
crash_store.save_raw_crash(
raw_crash=raw_crash,
dumps=DotDict,
crash_id='crash_id'
)
ok_(not crash_store.transaction.called)