fake_data

Populate a non-production environment with fake data.

gratipay.fake_data.insert_fake_data(db, tablename, **kw)[source]

Insert fake data into the database.

Parameters:
  • db (Postgres) – a Postgres or Cursor object
  • tablename (unicode) – the name of the table to insert into
  • kw (dict) – a mapping of column names to values
gratipay.fake_data.fake_text_id(size=6, chars='abcdefghijklmnopqrstuvwxyz0123456789')[source]

Create a random text id.

gratipay.fake_data.fake_sentence(start=1, stop=100)[source]

Create a sentence of random length.

gratipay.fake_data.fake_participant(db, is_admin=False, random_identities=True)[source]

Create a fake User.

Parameters:
  • db (Postgres) – a Postgres or Cursor object
  • is_admin (bool) – whether to make the participant an admin
  • random_identities (bool) – whether to give the participant random identities
gratipay.fake_data.fake_participant_identity(participant, verification=None)[source]

Pick a country and make an identity for the participant there.

Parameters:
  • participant (Participant) – a participant object
  • verification (bool) – the value to set verification to; None will result in a 50% chance either way
Returns:

a country id

gratipay.fake_data.fake_team(db, teamowner, teamname=None)[source]

Create a fake team

gratipay.fake_data.fake_payment_instruction(db, participant, team)[source]

Create a fake payment_instruction

gratipay.fake_data.fake_elsewhere(db, participant, platform)[source]

Create a fake elsewhere.

gratipay.fake_data.fake_payment(db, participant, team, timestamp, amount, payday, direction)[source]

Create fake payment

gratipay.fake_data.fake_exchange(db, participant, amount, fee, timestamp)[source]

Create a fake exchange for a participant

gratipay.fake_data.populate_db(db, nparticipants=100, ntips=200, nteams=5, npackages=5)[source]

Populate DB with fake data.