Implement propagating account data to ads

This commit is contained in:
2022-03-08 20:42:47 +00:00
parent aefa6c58a4
commit f2c9725fcb
9 changed files with 264 additions and 123 deletions

View File

@@ -229,3 +229,32 @@ class TestAgora(TestCase):
# Test specifying rates=
lookup_rates_return = self.agora.money.lookup_rates(enum_ads_return, rates=cg_prices)
self.assertCountEqual(lookup_rates_return, expected_return)
def test_format_ad(self):
settings.settings.Agora.Ad = """* Set **Country of recipient's bank** to **"United Kingdom"**
$PAYMENT$
* Set **Company name** to **"PATHOGEN LIMITED"**"""
payment_details = {"sort_code": "02-03-04", "account_number": "0023-0045"}
payment_details_text = self.agora.format_payment_details("GBP", payment_details)
ad_text = self.agora.format_ad("XMR", "GBP", payment_details_text)
expected = """* Set **Country of recipient's bank** to **"United Kingdom"**
* Company name: **PATHOGEN LIMITED**
* Sort code: **02-03-04**
* Account number: **0023-0045**
* Please send in **GBP**
* If you are asked for address information, please use **24 Holborn Viaduct, London, England, EC1A 2BN**
* The post code is **EC1A 2BN**
* Set **Company name** to **"PATHOGEN LIMITED"**"""
self.assertEqual(ad_text, expected)
def test_format_payment_details(self):
payment_details = {"sort_code": "02-03-04", "account_number": "0023-0045"}
payment_details_text = self.agora.format_payment_details("GBP", payment_details)
expected = """* Company name: **PATHOGEN LIMITED**
* Sort code: **02-03-04**
* Account number: **0023-0045**
* Please send in **GBP**
* If you are asked for address information, please use **24 Holborn Viaduct, London, England, EC1A 2BN**
* The post code is **EC1A 2BN**"""
self.assertEqual(payment_details_text, expected)