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] == []
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'
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 == []
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
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 == []
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
def test_partial_info_is_fine(self): parsed, errors = _parse(PARTIAL) assert parsed == PARTIAL assert errors == []
def test_bad_values_get_scrubbed_and_flagged(self): parsed, errors = _parse(BAD) assert parsed == SCRUBBED assert errors == ALL
def test_good_values_survive(self): parsed, errors = _parse(GOOD) assert parsed == GOOD assert errors == []
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'