コード例 #1
0
    def test_10_dollar_minimum(self):
        bad = GOOD.copy()
        bad['amount'] = '9'
        assert _parse(bodified(bad))[1] == ['amount']

        good = GOOD.copy()
        good['amount'] = '10'
        assert _parse(bodified(good))[1] == []
コード例 #2
0
 def test_sends_invoice_link(self):
     parsed, errors = _parse(bodified(GOOD))
     parsed.pop('payment_method_nonce')
     payment_for_open_source = _store(parsed)
     _send(self.app, payment_for_open_source)
     msg = self.get_last_email()
     assert msg['to'] == '*****@*****.**'
     assert msg['subject'] == 'Invoice from Gratipay'
コード例 #3
0
 def test_partial_info_is_fine(self):
     parsed, errors = _parse(bodified(PARTIAL))
     assert parsed.pop('promotion_logo') == (ORIGINAL, LARGE, SMALL, 'image/png')
     expected = PARTIAL.copy(); del expected['promotion_logo']
     assert parsed == expected
     assert errors == []
コード例 #4
0
 def test_bad_values_get_scrubbed_and_flagged(self):
     parsed, errors = _parse(bodified(BAD))
     assert parsed.pop('promotion_logo') is None
     expected = SCRUBBED.copy(); del expected['promotion_logo']
     assert parsed == expected
     assert errors == ALL
コード例 #5
0
 def test_good_values_survive(self):
     parsed, errors = _parse(bodified(GOOD))
     assert parsed.pop('promotion_logo') == (ORIGINAL, LARGE, SMALL, 'image/png')
     expected = GOOD.copy(); del expected['promotion_logo']
     assert parsed == expected
     assert errors == []
コード例 #6
0
 def test_stores_info(self):
     parsed, errors = _parse(bodified(GOOD))
     parsed.pop('payment_method_nonce')
     assert self.fetch() is None
     _store(parsed)
     assert self.fetch().on_mailing_list
コード例 #7
0
 def test_partial_info_is_fine(self):
     parsed, errors = _parse(PARTIAL)
     assert parsed == PARTIAL
     assert errors == []
コード例 #8
0
 def test_bad_values_get_scrubbed_and_flagged(self):
     parsed, errors = _parse(BAD)
     assert parsed == SCRUBBED
     assert errors == ALL
コード例 #9
0
 def test_good_values_survive(self):
     parsed, errors = _parse(GOOD)
     assert parsed == GOOD
     assert errors == []
コード例 #10
0
 def test_stores_info(self):
     parsed, errors = _parse(GOOD)
     parsed.pop('payment_method_nonce')
     assert self.fetch() is None
     _store(parsed)
     assert self.fetch().follow_up == 'monthly'