本文整理汇总了Python中gratipay.models.account_elsewhere.AccountElsewhere类的典型用法代码示例。如果您正苦于以下问题:Python AccountElsewhere类的具体用法?Python AccountElsewhere怎么用?Python AccountElsewhere使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AccountElsewhere类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_opt_in_notification_includes_unsubscribe
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: make_elsewhere
def make_elsewhere(self, platform, user_id, user_name, **kw):
info = UserInfo( platform=platform
, user_id=unicode(user_id)
, user_name=user_name
, **kw
)
return AccountElsewhere.upsert(info)
示例3: make_elsewhere
def make_elsewhere(self, platform, user_id, user_name, **kw):
"""Factory for :py:class:`~gratipay.models.account_elsewhere.AccountElsewhere`.
"""
info = UserInfo( platform=platform
, user_id=unicode(user_id)
, user_name=user_name
, **kw
)
return AccountElsewhere.upsert(info)
示例4: make_elsewhere
def make_elsewhere(self, platform, user_id, user_name, is_locked=False, **kw):
info = UserInfo( platform=platform
, user_id=unicode(user_id)
, user_name=user_name
, **kw
)
account = AccountElsewhere.upsert(info)
if is_locked:
account.set_is_locked(True)
return account
示例5: test_opt_in_sends_notifications_to_patrons
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']
示例6: 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.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)
示例7: 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.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)
示例8: check
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]
示例9: test_upsert
def test_upsert(self):
for platform in self.platforms:
user_info = getattr(user_info_examples, platform.name)()
account = AccountElsewhere.upsert(platform.extract_user_info(user_info))
assert isinstance(account, AccountElsewhere)
示例10: test_github_get_friends_for
def test_github_get_friends_for(self):
platform = self.platforms.github
user_info = platform.extract_user_info(user_info_examples.github())
account = AccountElsewhere.upsert(user_info)
friends, nfriends, pages_urls = platform.get_friends_for(account)
assert nfriends > 0
示例11: test_logging_in_doesnt_reset_goal
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