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')
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')
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)
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)
def test_save_raw_crash_normal(self): config = self._setup_config() crash_store = RabbitMQCrashStorage(config) with patch( 'socorro.external.rabbitmq.crashstorage.retry') as retry_mock: # test for "legacy_processing" missing from crash crash_store.save_raw_crash(raw_crash=DotDict(), dumps=DotDict(), crash_id='crash_id') assert not retry_mock.called with patch( 'socorro.external.rabbitmq.crashstorage.retry') as retry_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') retry_mock.assert_called_with(crash_store.rabbitmq, crash_store.quit_check, crash_store._save_raw_crash, crash_id='crash_id') with patch( 'socorro.external.rabbitmq.crashstorage.retry') as retry_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') assert not retry_mock.called
def test_save_raw_crash(self): config = self._setup_config() crash_store = RabbitMQCrashStorage(config) crash_store.save_raw_crash( raw_crash=DotDict(), dumps=DotDict(), crash_id='crash_id' ) config.logger.reset_mock() 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() raw_crash = DotDict() raw_crash.legacy_processing = 5; crash_store.save_raw_crash( raw_crash=raw_crash, dumps=DotDict, crash_id='crash_id' )
def test_save_raw_crash_no_legacy(self): config = self._setup_config() config.filter_on_legacy_processing = False crash_store = RabbitMQCrashStorage(config) with patch('socorro.external.rabbitmq.crashstorage.retry') as retry_mock: # test for "legacy_processing" missing from crash crash_store.save_raw_crash( raw_crash=DotDict(), dumps=DotDict(), crash_id='crash_id' ) retry_mock.assert_called_with( crash_store.rabbitmq, crash_store.quit_check, crash_store._save_raw_crash, crash_id='crash_id' ) with patch('socorro.external.rabbitmq.crashstorage.retry') as retry_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' ) retry_mock.assert_called_with( crash_store.rabbitmq, crash_store.quit_check, crash_store._save_raw_crash, crash_id='crash_id' ) with patch('socorro.external.rabbitmq.crashstorage.retry') as retry_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' ) retry_mock.assert_called_with( crash_store.rabbitmq, crash_store.quit_check, crash_store._save_raw_crash, crash_id='crash_id' )
def test_save_raw_crash_normal(self): config = self._setup_config() crash_store = RabbitMQCrashStorage(config) with patch('socorro.external.rabbitmq.crashstorage.retry') as retry_mock: # test for "legacy_processing" missing from crash crash_store.save_raw_crash( raw_crash=DotDict(), dumps=DotDict(), crash_id='crash_id' ) assert not retry_mock.called with patch('socorro.external.rabbitmq.crashstorage.retry') as retry_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' ) retry_mock.assert_called_with( crash_store.rabbitmq, crash_store.quit_check, crash_store._save_raw_crash, crash_id='crash_id' ) with patch('socorro.external.rabbitmq.crashstorage.retry') as retry_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' ) assert not retry_mock.called
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)
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)