def create_deposits(app, test_records_data, creator): """Create test deposits.""" DepositInfo = namedtuple('DepositInfo', ['id', 'data', 'deposit']) with authenticated_user(creator): deposits = [Deposit.create(data=data) for data in deepcopy(test_records_data)] for deposit in deposits: deposit.commit() deposit.commit() return [DepositInfo(dep.id, dep.dumps(), dep) for dep in deposits]
def create_deposits(app, test_records_data, creator): """Create test deposits.""" DepositInfo = namedtuple('DepositInfo', ['deposit_id', 'data', 'deposit']) deposits = [] with authenticated_user(creator): for data in deepcopy(test_records_data): record_uuid = uuid.uuid4() # Create persistent identifier b2share_deposit_uuid_minter(record_uuid, data=data) deposits.append(Deposit.create(data=data, id_=record_uuid)) return [DepositInfo(dep.id, dep.dumps(), dep) for dep in deposits]
def create_deposits(app, test_records_data, creator): """Create test deposits.""" DepositInfo = namedtuple( 'DepositInfo', [ 'deposit_id', 'data', 'deposit', # FIXME: replaced by get_deposit, remove it later 'get_deposit' ]) deposits = [] with authenticated_user(creator): for data in deepcopy(test_records_data): record_uuid = uuid.uuid4() # Create persistent identifier b2share_deposit_uuid_minter(record_uuid, data=data) deposits.append(B2ShareDeposit.create(data=data, id_=record_uuid)) return [DepositInfo( dep.id, dep.dumps(), dep, (lambda id: lambda: B2ShareDeposit.get_record(id))(dep.id) ) for dep in deposits]
def create_deposits(app, test_records_data, creator): """Create test deposits.""" DepositInfo = namedtuple( 'DepositInfo', [ 'deposit_id', 'data', 'deposit', # FIXME: replaced by get_deposit, remove it later 'get_deposit' ]) deposits = [] with authenticated_user(creator): for data in deepcopy(test_records_data): record_uuid = uuid.uuid4() # Create persistent identifier b2share_deposit_uuid_minter(record_uuid, data=data) deposits.append(B2ShareDeposit.create(data=data, id_=record_uuid)) return [ DepositInfo(dep.id, dep.dumps(), dep, (lambda id: lambda: B2ShareDeposit.get_record(id))(dep.id)) for dep in deposits ]