-
Notifications
You must be signed in to change notification settings - Fork 43
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 #373 from Mangopay/feature/virtual-accounts
Feature/virtual accounts
- Loading branch information
Showing
5 changed files
with
201 additions
and
3 deletions.
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
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
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,45 @@ | ||
from mangopay.resources import VirtualAccount, \ | ||
VirtualAccountAvailability | ||
from tests.test_base import BaseTestLive | ||
|
||
|
||
class VirtualAccountTest(BaseTestLive): | ||
|
||
def test_create_virtual_account(self): | ||
virtual_account = BaseTestLive.create_new_virtual_account() | ||
|
||
self.assertIsNotNone(virtual_account) | ||
self.assertEqual(virtual_account.status, 'ACTIVE') | ||
|
||
def test_get_virtual_account(self): | ||
virtual_account = BaseTestLive.create_new_virtual_account() | ||
wallet = BaseTestLive.get_johns_wallet() | ||
fetched = VirtualAccount.get(virtual_account.id, **{'wallet_id': wallet.id}) | ||
|
||
self.assertIsNotNone(fetched) | ||
self.assertEqual(virtual_account.id, fetched.id) | ||
|
||
def test_get_all_virtual_accounts(self): | ||
BaseTestLive.create_new_virtual_account() | ||
wallet = BaseTestLive.get_johns_wallet() | ||
fetched = VirtualAccount.all(**{'wallet_id': wallet.id}) | ||
|
||
self.assertIsNotNone(fetched) | ||
self.assertEqual(1, len(fetched)) | ||
|
||
def test_deactivate_virtual_account(self): | ||
virtual_account = BaseTestLive.create_new_virtual_account() | ||
wallet = BaseTestLive.get_johns_wallet() | ||
|
||
result_dict = VirtualAccount.update(virtual_account.id, **{'wallet_id': wallet.id}).execute() | ||
deactivated = VirtualAccount(**result_dict) | ||
|
||
self.assertIsNotNone(deactivated) | ||
self.assertEqual(virtual_account.id, deactivated.id) | ||
self.assertEqual(deactivated.status, "CLOSED") | ||
|
||
def test_get_availabilities(self): | ||
availabilities = VirtualAccountAvailability.all() | ||
self.assertIsNotNone(availabilities) | ||
self.assertEqual(1, len(availabilities)) | ||
|