-
Notifications
You must be signed in to change notification settings - Fork 19
add cardReversalTransaction to codecs #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
new test:
compare TransactionDTO's in mappings to TransactionDTO's in model.
- Loading branch information
commit d395624a39226dd52840e30515798f4c2b70f3c9
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
| import unittest | ||
| from unit import Unit | ||
| from unit.models.transaction import * | ||
| from unit.models.codecs import mappings | ||
|
|
||
| token = os.environ.get('TOKEN') | ||
| client = Unit("https://api.s.unit.sh", token) | ||
|
|
@@ -89,7 +90,6 @@ def test_sending_wire_transaction(): | |
| assert transaction.attributes["counterparty"].routing_number == "812345678" | ||
| assert transaction.attributes["referenceForBeneficiary"] == "Test" | ||
|
|
||
|
|
||
| def test_receiving_wire_transaction(): | ||
| wire_transaction_api_response = { | ||
| "type": "wireTransaction", | ||
|
|
@@ -151,7 +151,6 @@ def test_receiving_wire_transaction(): | |
| assert transaction.attributes["counterparty"].routing_number == "812345678" | ||
| assert transaction.attributes["senderReference"] == "Test" | ||
|
|
||
|
|
||
| def test_card_transaction(): | ||
| card_transaction_api_response = { | ||
| "type": "cardTransaction", | ||
|
|
@@ -335,7 +334,6 @@ def test_purchase_transaction(): | |
| assert transaction.attributes["digitalWallet"] == "Apple" | ||
| assert transaction.attributes["paymentMethod"] == "Contactless" | ||
|
|
||
|
|
||
| def test_list_and_get_transactions_with_type(): | ||
| transaction_ids = [] | ||
| response = client.transactions.list(ListTransactionParams(100, 0, type=["Fee", "ReceivedAch"])) | ||
|
|
@@ -348,3 +346,28 @@ def test_list_and_get_transactions_with_type(): | |
| response = client.transactions.get(id) | ||
| assert response.data.type == "receivedAchTransaction" or response.data.type == "feeTransaction" | ||
|
|
||
|
|
||
| def test_codecs_transactions(): | ||
| import inspect | ||
| import unit.models.transaction as foo | ||
|
|
||
| classes = [] | ||
|
|
||
| p = 'unit.models.transaction.' | ||
| for name, obj in inspect.getmembers(foo): | ||
| if inspect.isclass(obj): | ||
| try: | ||
| s = str(obj) | ||
chita13 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if 'Transaction' in s and 'DTO' in s and 'Base' not in s: | ||
chita13 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| i = s.index(p) + len(p) | ||
| j = s.index('DTO\'>') | ||
| classes.append(s[i:j]) | ||
| except e: | ||
| print(e) | ||
| continue | ||
|
|
||
|
|
||
| transactions = [x.lower() for x in mappings if "Transaction" in x] | ||
|
||
| for c in classes: | ||
| if c.lower() not in transactions: | ||
| assert False | ||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.