You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
3.6 KiB
Python

from django.test import TransactionTestCase
from core.clients.platforms.agora import AgoraClient
from core.models import Ad, Asset, Provider
from core.tests.helpers import AggregatorPlatformMixin
class TestPlatform(AggregatorPlatformMixin, TransactionTestCase):
def setUp(self):
super().setUp()
self.aggregator.account_info = {
"MONZO_MONZGB2L": [
{
"resourceId": "ssss",
"currency": "GBP",
"ownerName": "JSNOW LIMITED",
"cashAccountType": "CACC",
"status": "enabled",
"maskedPan": None,
"details": "Private Limited Company",
"bban": "ssss",
"name": None,
"product": None,
"bic": None,
"recipient": "TODO",
"account_id": "s-s-s-s-s",
"aggregator_id": str(self.aggregator.id),
"requisition_id": "3ba3e65d-f44c-4c4e-9e28-08cc080830f6",
"account_number": {"sort_code": "04-00-04", "number": "00000002"},
},
{
"resourceId": "ssss",
"currency": "GBP",
"ownerName": "John Snow Smith",
"cashAccountType": "CACC",
"status": "enabled",
"maskedPan": None,
"details": "Personal Account",
"bban": "ssss",
"name": None,
"product": None,
"bic": None,
"recipient": "TODO",
"account_id": "s-s-s-s-s",
"aggregator_id": str(self.aggregator.id),
"requisition_id": "3ba3e65d-f44c-4c4e-9e28-08cc080830f6",
"account_number": {"sort_code": "04-00-04", "number": "00000001"},
},
]
}
self.aggregator.save()
self.plat_client = AgoraClient(self.platform)
asset = Asset.objects.create(
code="XMR",
name="Monero",
)
provider = Provider.objects.create(
code="REVOLUT",
name="Revolut",
)
self.ad = Ad.objects.create(
user=self.user,
name="Test",
text="Ad text",
payment_details="Payment details",
payment_details_real="Payment details real",
payment_method_details="Payment method details",
dist_list="",
asset_list=[asset],
provider_list=[provider],
platforms=[self.platform],
aggregators=[self.aggregator],
send_reference=True,
visible=True,
enabled=True,
)
def test_get_valid_account_details(self):
result = self.plat_client.get_valid_account_details(self.ad)
def test_get_matching_account_details(self):
result = self.plat_client.get_matching_account_details("GBP", self.ad)
def test_format_payment_details(self):
account_info = self.plat_client.get_matching_account_details("GBP", self.ad)
result = self.plat_client.format_payment_details(
"GBP",
account_info,
self.ad,
real=False,
)
def test_format_payment_details_real(self):
account_info = self.plat_client.get_matching_account_details("GBP", self.ad)
result = self.plat_client.format_payment_details(
"GBP",
account_info,
self.ad,
real=True,
)