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


Python payday.Payday类代码示例

本文整理汇总了Python中gittip.billing.payday.Payday的典型用法代码示例。如果您正苦于以下问题:Python Payday类的具体用法?Python Payday怎么用?Python Payday使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Payday类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: payday

def payday():

    # Wire things up.
    # ===============

    env = wireup.env()
    db = wireup.db(env)

    wireup.billing(env)
    wireup.nanswers(env)


    # Lazily import the billing module.
    # =================================
    # This dodges a problem where db in billing is None if we import it from
    # gittip before calling wireup.billing.

    from gittip.billing.exchanges import sync_with_balanced
    from gittip.billing.payday import Payday

    try:
        with db.get_cursor() as cursor:
            sync_with_balanced(cursor)
        Payday.start().run()
    except KeyboardInterrupt:
        pass
    except:
        import aspen
        import traceback
        aspen.log(traceback.format_exc())
开发者ID:maryannbanks,项目名称:www.gittip.com,代码行数:30,代码来源:cli.py

示例2: test_card_hold_error

 def test_card_hold_error(self, Customer, fch):
     self.janet.set_tip_to(self.homer, 17)
     Customer.side_effect = Foobar
     fch.return_value = {}
     Payday.start().payin()
     payday = self.fetch_payday()
     assert payday['ncc_failing'] == 1
开发者ID:maryannbanks,项目名称:www.gittip.com,代码行数:7,代码来源:test_billing_payday.py

示例3: test_paydays_json_gives_paydays

    def test_paydays_json_gives_paydays(self):
        Payday.start()
        self.make_participant("alice")

        response = self.client.GET("/about/paydays.json")
        paydays = json.loads(response.body)
        assert paydays[0]['ntippers'] == 0
开发者ID:maryannbanks,项目名称:www.gittip.com,代码行数:7,代码来源:test_paydays_json.py

示例4: test_payout_ach_error

 def test_payout_ach_error(self, ach_credit):
     self.make_participant('alice', claimed_time='now', is_suspicious=False,
                           balance=20, balanced_customer_href='foo',
                           last_ach_result='')
     ach_credit.return_value = 'some error'
     Payday.start().payout()
     payday = self.fetch_payday()
     assert payday['nach_failing'] == 1
开发者ID:maryannbanks,项目名称:www.gittip.com,代码行数:8,代码来源:test_billing_payday.py

示例5: test_update_receiving_amounts_updates_receiving_amounts

    def test_update_receiving_amounts_updates_receiving_amounts(self):
        A = self.make_participant('A')
        B = self.make_participant('B', claimed_time='now', last_bill_result='')
        B.set_tip_to(A, D('10.00'), update_tippee=False)
        assert Participant.from_username('A').receiving == 0

        Payday.start().update_receiving_amounts()
        assert Participant.from_username('A').receiving == 10
开发者ID:maryannbanks,项目名称:www.gittip.com,代码行数:8,代码来源:test_billing_payday.py

示例6: test_payin_doesnt_make_null_transfers

 def test_payin_doesnt_make_null_transfers(self):
     alice = self.make_participant('alice', claimed_time='now')
     alice.set_tip_to(self.homer, 1)
     alice.set_tip_to(self.homer, 0)
     a_team = self.make_participant('a_team', claimed_time='now', number='plural')
     a_team.add_member(alice)
     Payday.start().payin()
     transfers0 = self.db.all("SELECT * FROM transfers WHERE amount = 0")
     assert not transfers0
开发者ID:maryannbanks,项目名称:www.gittip.com,代码行数:9,代码来源:test_billing_payday.py

示例7: test_prep_hit_basically_works

def test_prep_hit_basically_works():
    payday = Payday(gittip.db)
    actual = payday._prep_hit(Decimal('20.00'))
    expected = ( 2110
               , u'Charging %s 2110 cents ($20.00 + $1.10 fee = $21.10) on %s '
                 u'... '
               , Decimal('21.10')
               , Decimal('1.10')
                )
    assert actual == expected, actual
开发者ID:gvenkataraman,项目名称:www.gittip.com,代码行数:10,代码来源:test_billing.py

示例8: test_prep_hit_full_in_rounded_case

def test_prep_hit_full_in_rounded_case():
    payday = Payday(gittip.db)
    actual = payday._prep_hit(Decimal('5.00'))
    expected = ( 1000
               , u'Charging %s 1000 cents ($9.32 [rounded up from $5.00] + '
                 u'$0.68 fee = $10.00) on %s ... '
               , Decimal('10.00')
               , Decimal('0.68')
                )
    assert actual == expected, actual
开发者ID:gvenkataraman,项目名称:www.gittip.com,代码行数:10,代码来源:test_billing.py

示例9: test_payday_moves_money

    def test_payday_moves_money(self, fch):
        self.janet.set_tip_to(self.homer, '6.00')  # under $10!
        fch.return_value = {}
        Payday.start().run()

        janet = Participant.from_username('janet')
        homer = Participant.from_username('homer')

        assert homer.balance == D('6.00')
        assert janet.balance == D('3.41')
开发者ID:maryannbanks,项目名称:www.gittip.com,代码行数:10,代码来源:test_billing_payday.py

示例10: test_stats_description_accurate_outside_of_payday

    def test_stats_description_accurate_outside_of_payday(self, mock_datetime):
        """Test stats page outside of the payday running"""
        a_monday = datetime(2012, 8, 6, 11, 00, 01)
        mock_datetime.utcnow.return_value = a_monday

        payday = Payday(self.postgres)
        payday.start()

        body = self.get_stats_page()
        assert "is ready for <b>this Thursday</b>" in body, body
        payday.end()
开发者ID:DylanLacey,项目名称:www.gittip.com,代码行数:11,代码来源:test_stats.py

示例11: test_payin_dumps_transfers_for_debugging

 def test_payin_dumps_transfers_for_debugging(self, cch, fch):
     self.janet.set_tip_to(self.homer, 10)
     fake_hold = mock.MagicMock()
     fake_hold.amount = 1500
     fch.return_value = {self.janet.id: fake_hold}
     cch.side_effect = Foobar
     open = mock.MagicMock()
     with mock.patch.dict(__builtins__, {'open': open}):
         with self.assertRaises(Foobar):
             Payday.start().payin()
     assert open.call_count == 1
开发者ID:maryannbanks,项目名称:www.gittip.com,代码行数:11,代码来源:test_billing_payday.py

示例12: test_transfer_takes_doesnt_make_negative_transfers

 def test_transfer_takes_doesnt_make_negative_transfers(self, fch):
     hold = balanced.CardHold(amount=1500, meta={'participant_id': self.janet.id})
     hold.capture = lambda *a, **kw: None
     hold.save = lambda *a, **kw: None
     fch.return_value = {self.janet.id: hold}
     self.janet.update_number('plural')
     self.janet.set_tip_to(self.homer, 10)
     self.janet.add_member(self.david)
     Payday.start().payin()
     assert Participant.from_id(self.david.id).balance == 0
     assert Participant.from_id(self.homer.id).balance == 10
     assert Participant.from_id(self.janet.id).balance == 0
开发者ID:maryannbanks,项目名称:www.gittip.com,代码行数:12,代码来源:test_billing_payday.py

示例13: test_payin_cancels_uncaptured_holds

 def test_payin_cancels_uncaptured_holds(self, log):
     self.janet.set_tip_to(self.homer, 42)
     alice = self.make_participant('alice', claimed_time='now',
                                   is_suspicious=False)
     self.make_exchange('bill', 50, 0, alice)
     alice.set_tip_to(self.janet, 50)
     Payday.start().payin()
     assert log.call_args_list[-3][0] == ("Captured 0 card holds.",)
     assert log.call_args_list[-2][0] == ("Canceled 1 card holds.",)
     assert Participant.from_id(alice.id).balance == 0
     assert Participant.from_id(self.janet.id).balance == 8
     assert Participant.from_id(self.homer.id).balance == 42
开发者ID:maryannbanks,项目名称:www.gittip.com,代码行数:12,代码来源:test_billing_payday.py

示例14: prep

def prep(amount):
    """Given a dollar amount as a string, return a 3-tuple.

    The return tuple is like the one returned from _prep_hit, but with the
    second value, a log message, removed.

    """
    typecheck(amount, unicode)
    payday = Payday(gittip.db)
    out = list(payday._prep_hit(Decimal(amount)))
    out = [out[0]] + out[2:]
    return tuple(out)
开发者ID:gvenkataraman,项目名称:www.gittip.com,代码行数:12,代码来源:test_billing.py

示例15: test_stats_description_accurate_outside_of_payday

def test_stats_description_accurate_outside_of_payday(mock_datetime):
    """Test stats page outside of the payday running"""
    with testing.load() as context:
        a_monday = datetime(2012, 8, 6, 12, 00, 01)
        mock_datetime.utcnow.return_value = a_monday

        pd = Payday(context.db)
        pd.start()

        body = get_stats_page()
        assert "is ready for <b>this Thursday</b>" in body, body
        pd.end()
开发者ID:break123,项目名称:www.gittip.com,代码行数:12,代码来源:test_stats.py


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