def setUp(self): Harness.setUp(self) self.alice = self.make_participant('alice', elsewhere='github') self.balanced_customer_href = unicode(balanced.Customer().save().href) self.card_href = unicode(balanced.Card( number='4111111111111111', expiration_month=10, expiration_year=2020, address={ 'line1': "123 Main Street", 'state': 'Confusion', 'postal_code': '90210', }, # gittip stores some of the address data in the meta fields, # continue using them to support backwards compatibility meta={ 'address_2': 'Box 2', 'city_town': '', 'region': 'Confusion', } ).save().href) # XXX Why don't we actually associate this with the customer? See XXX in # test_billing_payday.TestPaydayChargeOnBalanced. self.bank_account_href = unicode(balanced.BankAccount( name='Homer Jay', account_number='112233a', routing_number='121042882', ).save().href)
def setUp(self): Harness.setUp(self) now = utcnow() for username in ['alice', 'bob', 'carl']: self.make_participant(username, claimed_time=now, elsewhere='twitter')
def setUp(self): Harness.setUp(self) self.alice = self.make_participant('alice', elsewhere='github') self.balanced_customer_href = unicode(balanced.Customer().save().href) self.card_href = unicode( balanced.Card( number='4111111111111111', expiration_month=10, expiration_year=2020, address={ 'line1': "123 Main Street", 'state': 'Confusion', 'postal_code': '90210', }, # gittip stores some of the address data in the meta fields, # continue using them to support backwards compatibility meta={ 'address_2': 'Box 2', 'city_town': '', 'region': 'Confusion', }).save().href ) # XXX Why don't we actually associate this with the customer? See XXX in # test_billing_payday.TestPaydayChargeOnBalanced. self.bank_account_href = unicode( balanced.BankAccount( name='Homer Jay', account_number='112233a', routing_number='121042882', ).save().href)
def setUp(self): Harness.setUp(self) self._blech = (os.environ["CANONICAL_SCHEME"], os.environ["CANONICAL_HOST"]) os.environ["CANONICAL_SCHEME"] = "https" os.environ["CANONICAL_HOST"] = "www.gittip.com" wireup.canonical()
def setUp(self): Harness.setUp(self) self._blech = (os.environ['CANONICAL_SCHEME'], os.environ['CANONICAL_HOST']) os.environ['CANONICAL_SCHEME'] = 'https' os.environ['CANONICAL_HOST'] = 'www.gittip.com' wireup.canonical()
def setUp(self): Harness.setUp(self) # Alice joins a community. self.alice = self.make_participant("alice", claimed_time='now', last_bill_result='') self.client.POST( '/for/communities.json' , {'name': 'something', 'is_member': 'true'} , auth_as='alice' )
def setUp(self): self.client = TestClient() Harness.setUp(self) self._blech = ( os.environ['CANONICAL_SCHEME'] , os.environ['CANONICAL_HOST'] ) os.environ['CANONICAL_SCHEME'] = 'https' os.environ['CANONICAL_HOST'] = 'www.gittip.com' wireup.canonical()
def setUp(self): Harness.setUp(self) now = utcnow() hour_ago = now - datetime.timedelta(hours=1) for username in ["alice", "bob", "carl"]: self.make_participant(username, claimed_time=hour_ago, last_bill_result="") deadbeef = self.make_elsewhere("twitter", "1", "deadbeef") self.deadbeef_original_username = deadbeef.participant.username Participant.from_username("carl").set_tip_to("bob", "1.00") Participant.from_username("alice").set_tip_to(self.deadbeef_original_username, "1.00") Participant.from_username("bob").take_over(deadbeef, have_confirmation=True)
def setUp(self): Harness.setUp(self) # Grab configuration from the environment, storing for later. env = wireup.env() self.environ = env.environ # Change env, doesn't change self.environ. env.canonical_scheme = 'https' env.canonical_host = 'www.gittip.com' wireup.canonical(env)
def setUp(self): Harness.setUp(self) # Alice joins a community. self.alice = self.make_participant("alice", claimed_time='now', last_bill_result='') self.client.POST('/for/communities.json', { 'name': 'something', 'is_member': 'true' }, auth_as='alice')
def setUp(self): Harness.setUp(self) self.alice = self.make_participant('alice', claimed_time='now') self.bob = self.make_participant('bob', claimed_time='now') self.carl = self.make_participant('carl', claimed_time='now') self.make_exchange('bill', 10, 0, self.alice) self.make_exchange('bill', 10, 0, self.bob) self.make_participant('notactive', claimed_time='now') self.alice.set_tip_to(self.carl, '1.00') self.bob.set_tip_to(self.carl, '2.00')
def setUp(self): Harness.setUp(self) now = utcnow() hour_ago = now - datetime.timedelta(hours=1) for username in ['alice', 'bob', 'carl']: p = self.make_participant(username, claimed_time=hour_ago, last_bill_result='') setattr(self, username, p) deadbeef = self.make_elsewhere('twitter', '1', 'deadbeef') self.deadbeef_original_username = deadbeef.participant.username self.carl.set_tip_to(self.bob, '1.00') self.alice.set_tip_to(self.deadbeef_original_username, '1.00') self.bob.take_over(deadbeef, have_confirmation=True)
def setUp(self): Harness.setUp(self) now = utcnow() hour_ago = now - datetime.timedelta(hours=1) for username in ['alice', 'bob', 'carl']: self.make_participant( username , claimed_time=hour_ago , last_bill_result='' ) deadbeef = TwitterAccount(self.db, '1', {'screen_name': 'deadbeef'}) self.deadbeef_original_username = deadbeef.participant Participant.from_username('carl').set_tip_to('bob', '1.00') Participant.from_username('alice').set_tip_to(self.deadbeef_original_username, '1.00') Participant.from_username('bob').take_over(deadbeef, have_confirmation=True)
def setUp(self): Harness.setUp(self) now = utcnow() hour_ago = now - datetime.timedelta(hours=1) for username in ['alice', 'bob', 'carl']: p = self.make_participant( username , claimed_time=hour_ago , last_bill_result='' ) setattr(self, username, p) deadbeef = self.make_elsewhere('twitter', '1', 'deadbeef') self.deadbeef_original_username = deadbeef.participant.username self.carl.set_tip_to(self.bob, '1.00') self.alice.set_tip_to(self.deadbeef_original_username, '1.00') self.bob.take_over(deadbeef, have_confirmation=True)
def setUp(self): Harness.setUp(self) self.alice = self.make_participant('alice', balance=10, claimed_time='now') self.bob = self.make_participant('bob', balance=10, claimed_time='now') self.carl = self.make_participant('carl', claimed_time='now') self.db.run(""" INSERT INTO EXCHANGES (amount, fee, participant) VALUES (10.00, 0.00, 'alice'), (10.00, 0.00, 'bob') """) self.make_participant('notactive', claimed_time='now') self.alice.set_tip_to(self.carl, '1.00') self.bob.set_tip_to(self.carl, '2.00')
def make_participant(self, username, *arg, **kw): participant = Harness.make_participant(self, username) if username == "alice": take_last_week = kw.get("take_last_week", "40") gittip.db.execute("INSERT INTO paydays DEFAULT VALUES") gittip.db.execute( "INSERT INTO transfers " "(timestamp, tipper, tippee, amount) " "VALUES (now(), 'Team', 'alice', %s)", (take_last_week,), ) return participant
def make_participant(self, username, *arg, **kw): take_last_week = kw.pop('take_last_week', '40') participant = Harness.make_participant(self, username, **kw) if username == 'alice': gittip.db.run("INSERT INTO paydays DEFAULT VALUES") gittip.db.run( "INSERT INTO transfers " "(timestamp, tipper, tippee, amount) " "VALUES (now(), 'Team', 'alice', %s)", (take_last_week, )) return participant
def setUp(self): Harness.setUp(self) now = utcnow() hour_ago = now - datetime.timedelta(hours=1) for i, username in enumerate(['alice', 'bob', 'carl']): p = self.make_participant( username , claimed_time=hour_ago , last_bill_result='' , balance=Decimal(i) ) setattr(self, username, p) deadbeef = self.make_participant('deadbeef', balance=Decimal('18.03'), elsewhere='twitter') self.expected_new_balance = self.bob.balance + deadbeef.balance deadbeef_twitter = AccountElsewhere.from_user_name('twitter', 'deadbeef') self.carl.set_tip_to(self.bob, '1.00') self.alice.set_tip_to(deadbeef, '1.00') self.bob.take_over(deadbeef_twitter, have_confirmation=True) self.deadbeef_archived = Participant.from_id(deadbeef.id)
def make_participant(self, username, *arg, **kw): take_last_week = kw.pop('take_last_week', '40') participant = Harness.make_participant(self, username, **kw) if username == 'alice': gittip.db.run("INSERT INTO paydays DEFAULT VALUES") gittip.db.run( "INSERT INTO transfers " "(timestamp, tipper, tippee, amount) " "VALUES (now(), 'Team', 'alice', %s)" , (take_last_week,) ) return participant
def make_participant(self, username, **kw): take_last_week = kw.pop('take_last_week', None) team_name = kw.pop('', TEAM) participant = Harness.make_participant(self, username, **kw) if take_last_week is not None: if self.db.one('SELECT * FROM paydays') is None: self.db.run("INSERT INTO paydays DEFAULT VALUES") self.db.run( "INSERT INTO transfers (timestamp, tipper, tippee, amount) " "VALUES (now(), %(tipper)s, %(tippee)s, %(amount)s)" , dict(tipper=team_name, tippee=username, amount=take_last_week,) ) return participant
def setUpClass(cls): Harness.setUpClass() cls.payday = Payday(mock.Mock()) # Mock out the DB connection
def make_participant(self, *a, **kw): kw['claimed_time'] = utcnow() return Harness.make_participant(self, *a, **kw)
def make_participant(self, *a, **kw): kw['claimed_time'] = datetime.datetime.now(pytz.utc) return Harness.make_participant(self, *a, **kw)
def tearDown(self): Harness.tearDown(self) os.environ['CANONICAL_SCHEME'] = self._blech[0] os.environ['CANONICAL_HOST'] = self._blech[1] wireup.canonical()
def setUp(self): Harness.setUp(self) self.bar = self.make_participant('bar', is_admin=True)
def setUp(self): Harness.setUp(self) self.make_participant('alice')
def tearDown(self): Harness.tearDown(self) reset = Environment(CANONICAL_SCHEME=unicode, CANONICAL_HOST=unicode, environ=self.environ) wireup.canonical(reset)
def tearDown(self): Harness.tearDown(self) self.website.oauth_cache = {}
def setUp(self): Harness.setUp(self) for participant in ['alice', 'bob']: self.make_participant(participant, last_bill_result='')
def setUp(self): Harness.setUp(self) simplate = self.client.load_resource(b'/about/stats.html') self.commaize = simplate.pages[0]['commaize']
def setUp(self): Harness.setUp(self) now = utcnow() for username in ["alice", "bob", "carl"]: self.make_participant(username, claimed_time=now, elsewhere="twitter")
def setUp(self): Harness.setUp(self) self.website = _test_website self.client = TestClient()
def setUp(self): Harness.setUp(self) self.participant = self.make_participant('user1') # Our protagonist
def setUp(self): Harness.setUp(self) self.payday = Payday(self.db)
def setUp(self): Harness.setUp(self) self.add_participant('alice') self.add_participant('bob') carl = self.add_participant('carl') carl.insert_into_communities(False, 'test', 'test')
def setUp(self): Harness.setUp(self) for participant in ['alice', 'bob']: p = self.make_participant(participant, claimed_time='now', last_bill_result='') setattr(self, participant, p)
def setUp(self): Harness.setUp(self) self.make_participant("team", claimed_time=utcnow(), number='plural') self.make_participant("alice", claimed_time=utcnow())
def setUp(self): Harness.setUp(self) for participant in ['alice', 'bob']: p = self.make_participant(participant, last_bill_result='') setattr(self, participant, p)
def setUp(self): Harness.setUp(self) self.team = self.make_participant('A-Team', number='plural')