当前位置: 首页>>代码示例>>Python>>正文


Python account_elsewhere.AccountElsewhere类代码示例

本文整理汇总了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']
开发者ID:SirCmpwn,项目名称:gratipay.com,代码行数:9,代码来源:test_email_notifs.py

示例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)
开发者ID:beerm,项目名称:gratipay.com,代码行数:7,代码来源:__init__.py

示例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)
开发者ID:PeterDaveHello,项目名称:gratipay.com,代码行数:9,代码来源:harness.py

示例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
开发者ID:9cat,项目名称:templecoin-gratipay,代码行数:10,代码来源:__init__.py

示例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']
开发者ID:SirCmpwn,项目名称:gratipay.com,代码行数:20,代码来源:test_email_notifs.py

示例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)
开发者ID:hdushku,项目名称:gratipay.com,代码行数:16,代码来源:test_participant.py

示例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)
开发者ID:crowdfundingsourcecode,项目名称:gratipay.com,代码行数:20,代码来源:test_participant.py

示例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]
开发者ID:9cat,项目名称:templecoin-gratipay,代码行数:20,代码来源:test_billing_payday.py

示例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)
开发者ID:Irkinosor,项目名称:gratipay.com,代码行数:5,代码来源:test_elsewhere.py

示例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
开发者ID:PeterDaveHello,项目名称:gratipay.com,代码行数:6,代码来源:test_elsewhere.py

示例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
开发者ID:SirCmpwn,项目名称:gratipay.com,代码行数:4,代码来源:test_elsewhere.py


注:本文中的gratipay.models.account_elsewhere.AccountElsewhere类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。