-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #629 from makerspace/emaus/fix-transaction
Fix error in 0b2834e
- Loading branch information
Showing
2 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from decimal import Decimal | ||
|
||
import membership.models | ||
import shop.models | ||
from service.db import db_session | ||
from shop.transactions import get_source_transaction | ||
from test_aid.test_base import FlaskTestBase | ||
|
||
|
||
class ShopDataTest(FlaskTestBase): | ||
models = [membership.models, shop.models] | ||
|
||
def test_finds_transaction_for_stripe_pending(self) -> None: | ||
member = self.db.create_member() | ||
transaction = self.db.create_transaction( | ||
member_id=member.member_id, | ||
amount=Decimal("50"), | ||
status=shop.models.Transaction.PENDING, | ||
) | ||
pending = shop.models.StripePending( | ||
transaction_id=transaction.id, | ||
stripe_token="stripe_token", | ||
) | ||
db_session.add(pending) | ||
db_session.commit() | ||
|
||
found_transaction = get_source_transaction("stripe_token") | ||
self.assertIsNotNone(found_transaction) | ||
self.assertEqual(transaction.id, found_transaction.id) |