本文整理汇总了Python中gittip.testing.Harness类的典型用法代码示例。如果您正苦于以下问题:Python Harness类的具体用法?Python Harness怎么用?Python Harness使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Harness类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
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()
示例2: setUp
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)
示例3: setUp
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'
)
示例4: setUp
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()
示例5: setUp
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)
示例6: setUp
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)
示例7: setUp
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')
示例8: setUp
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)
示例9: setUp
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')
示例10: setUp
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)
示例11: make_participant
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
示例12: setUp
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)
示例13: make_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
示例14: make_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
示例15: make_participant
def make_participant(self, *a, **kw):
kw['claimed_time'] = datetime.datetime.now(pytz.utc)
return Harness.make_participant(self, *a, **kw)