def test_it_raises_UnsupportedOperationError_for_invalid_actions( self, db_session, command_type, data_type, commands ): executor = BulkExecutor(db_session) with pytest.raises(UnsupportedOperationError): executor.execute_batch(command_type, data_type, commands, {})
def test_it_calls_correct_db_handler(self, db_session, command_type, data_type, handler, commands): executor = BulkExecutor(db_session, authority=AUTHORITY) handler.assert_called_once_with(db_session) executor.effective_user_id = 1 # These commands aren't actually the right type, but it doesn't # matter for this test executor.execute_batch(command_type, data_type, {"config_option": 2}, commands) bulk_upsert = handler.return_value bulk_upsert.execute.assert_called_once_with(commands, effective_user_id=1, config_option=2)