def test_flags_failures_with_transaction_id(self):
     failure = GOOD.copy()
     failure['amount'] = '2000'
     result = pay_for_open_source(self.app, bodified(failure))
     assert result['errors'] == ['charging']
     pfos = self.fetch()
     assert not pfos.succeeded
     assert pfos.braintree_transaction_id is not None
 def test_flags_errors_with_no_transaction_id(self):
     error = GOOD.copy()
     error['payment_method_nonce'] = 'deadbeef'
     result = pay_for_open_source(self.app, bodified(error))
     assert result['errors'] == ['charging']
     pfos = self.fetch()
     assert not pfos.succeeded
     assert pfos.braintree_transaction_id is None
 def test_pays_for_open_source(self):
     assert self.fetch() is None
     result = pay_for_open_source(self.app, bodified(GOOD))
     assert not result['errors']
     assert 'invoice.html?secret=' in result['invoice_url']
     assert self.fetch().succeeded
 def test_flags_errors_and_doesnt_store(self):
     assert self.fetch() is None
     result = pay_for_open_source(self.app, bodified(BAD))
     assert result == {'errors': ALL, 'invoice_url': None}
     assert self.fetch() is None
 def test_pays_for_open_source(self):
     assert self.fetch() is None
     result = pay_for_open_source(self.app, self.good)
     assert not result['errors']
     assert result['invoice_url'].endswith('invoice.html')
     assert self.fetch().succeeded