本文整理汇总了Python中gratipay.models.account_elsewhere.AccountElsewhere.from_user_name方法的典型用法代码示例。如果您正苦于以下问题:Python AccountElsewhere.from_user_name方法的具体用法?Python AccountElsewhere.from_user_name怎么用?Python AccountElsewhere.from_user_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gratipay.models.account_elsewhere.AccountElsewhere
的用法示例。
在下文中一共展示了AccountElsewhere.from_user_name方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_opt_in_notification_includes_unsubscribe
# 需要导入模块: from gratipay.models.account_elsewhere import AccountElsewhere [as 别名]
# 或者: from gratipay.models.account_elsewhere.AccountElsewhere import from_user_name [as 别名]
def test_opt_in_notification_includes_unsubscribe(self):
carl_twitter = self.make_elsewhere('twitter', 1, 'carl')
roy = self.make_participant('roy', claimed_time='now', email_address='[email protected]', notify_on_opt_in=1)
roy.set_tip_to(carl_twitter.participant.username, '100')
AccountElsewhere.from_user_name('twitter', 'carl').opt_in('carl')
Participant.dequeue_emails()
assert "To stop receiving" in self.get_last_email()['text']
示例2: test_opt_in_sends_notifications_to_patrons
# 需要导入模块: from gratipay.models.account_elsewhere import AccountElsewhere [as 别名]
# 或者: from gratipay.models.account_elsewhere.AccountElsewhere import from_user_name [as 别名]
def test_opt_in_sends_notifications_to_patrons(self):
carl_twitter = self.make_elsewhere('twitter', 1, 'carl')
roy = self.make_participant('roy', claimed_time='now', email_address='[email protected]')
self.client.POST( '/roy/emails/notifications.json'
, data={'toggle': 'notify_on_opt_in'}
, auth_as='roy'
)
self.bob.set_tip_to(carl_twitter.participant.username, '100')
self.dan.set_tip_to(carl_twitter.participant.username, '100')
roy.set_tip_to(carl_twitter.participant.username, '100') # Roy will NOT receive an email.
AccountElsewhere.from_user_name('twitter', 'carl').opt_in('carl')
Participant.dequeue_emails()
assert self.mailer.call_count == 2 # Emails should only be sent to bob and dan
last_email = self.get_last_email()
assert last_email['to'][0]['email'] == '[email protected]'
expected = "to carl"
assert expected in last_email['text']
示例3: setUp
# 需要导入模块: from gratipay.models.account_elsewhere import AccountElsewhere [as 别名]
# 或者: from gratipay.models.account_elsewhere.AccountElsewhere import from_user_name [as 别名]
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.make_tip(self.carl, self.bob, "1.00")
self.make_tip(self.alice, deadbeef, "1.00")
self.bob.take_over(deadbeef_twitter, have_confirmation=True)
self.deadbeef_archived = Participant.from_id(deadbeef.id)
示例4: setUp
# 需要导入模块: from gratipay.models.account_elsewhere import AccountElsewhere [as 别名]
# 或者: from gratipay.models.account_elsewhere.AccountElsewhere import from_user_name [as 别名]
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.make_tip(self.carl, self.bob, '1.00')
self.make_tip(self.alice, deadbeef, '1.00')
self.bob.take_over(deadbeef_twitter, have_confirmation=True)
self.deadbeef_archived = Participant.from_id(deadbeef.id)
示例5: check
# 需要导入模块: from gratipay.models.account_elsewhere import AccountElsewhere [as 别名]
# 或者: from gratipay.models.account_elsewhere.AccountElsewhere import from_user_name [as 别名]
def check():
alice = Participant.from_username('alice')
bob = Participant.from_username('bob')
carl = Participant.from_username('carl')
dana = Participant.from_username('dana')
emma = AccountElsewhere.from_user_name('github','emma').participant
assert alice.giving == D('13.00')
assert alice.pledging == D('1.00')
assert alice.receiving == D('5.00')
assert bob.giving == D('5.00')
assert bob.receiving == D('7.00')
assert bob.taking == D('1.00')
assert carl.giving == D('0.00')
assert carl.receiving == D('0.00')
assert dana.receiving == D('3.00')
assert dana.npatrons == 1
assert emma.receiving == D('1.00')
assert emma.npatrons == 1
funded_tips = self.db.all("SELECT amount FROM tips WHERE is_funded ORDER BY id")
assert funded_tips == [3, 6, 1, 4, 10, 5]
示例6: test_logging_in_doesnt_reset_goal
# 需要导入模块: from gratipay.models.account_elsewhere import AccountElsewhere [as 别名]
# 或者: from gratipay.models.account_elsewhere.AccountElsewhere import from_user_name [as 别名]
def test_logging_in_doesnt_reset_goal(self):
self.make_participant('alice', claimed_time='now', elsewhere='twitter', goal=100)
alice = AccountElsewhere.from_user_name('twitter', 'alice').opt_in('alice')[0].participant
assert alice.goal == 100