Skip to content

Commit

Permalink
Update VPN pricing for Romania, Bulgaria, and Hungary [fix mozilla#13299
Browse files Browse the repository at this point in the history
]

Also fix locale code for Czech 🤦
  • Loading branch information
craigcook authored and alexgibson committed Jun 22, 2023
1 parent 8fa66c3 commit 736b9a5
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 143 deletions.
112 changes: 24 additions & 88 deletions bedrock/products/tests/test_helper_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@
TEST_VPN_SUBSCRIPTION_URL = "https://accounts.firefox.com/"

TEST_VPN_PLAN_ID_MATRIX = {
"bgn": { # Bulgarian lev
"en": { # English
"12-month": {"id": "price_1N7PGEJNcmPzuWtRzTe85nzw", "price": "10 лв", "total": "120 лв", "saving": 50},
"monthly": {"id": "price_1N7PHRJNcmPzuWtRjZ8D8kwx", "price": "20 лв", "total": None, "saving": None},
},
},
"chf": { # Swiss franc
"de": { # German
"12-month": {"id": "price_1J5JssJNcmPzuWtR616BH4aU", "price": "CHF 5.99", "total": "CHF 71.88", "saving": 45},
Expand All @@ -36,7 +30,7 @@
},
},
"czk": { # Czech koruna
"cz": { # Czech
"cs": { # Czech
"12-month": {"id": "price_1N7PDwJNcmPzuWtR1IxSkZ0c", "price": "119 Kč", "total": "1,428 Kč", "saving": 50},
"monthly": {"id": "price_1N7PESJNcmPzuWtRTgmv8Ve4", "price": "237 Kč", "total": None, "saving": None},
},
Expand All @@ -48,6 +42,10 @@
},
},
"euro": { # Euro
"bg": { # Bulgarian
"12-month": {"id": "price_1N7PGEJNcmPzuWtRzTe85nzw", "price": "4,99 €", "total": "59,88 €", "saving": 50},
"monthly": {"id": "price_1N7PHRJNcmPzuWtRjZ8D8kwx", "price": "9,99 €", "total": None, "saving": None},
},
"de": { # German
"12-month": {"id": "price_1IgwblJNcmPzuWtRynC7dqQa", "price": "4,99 €", "total": "59,88 €", "saving": 50},
"monthly": {
Expand All @@ -74,6 +72,10 @@
"12-month": {"id": "price_1IgnlcJNcmPzuWtRjrNa39W4", "price": "4,99 €", "total": "59,88 €", "saving": 50},
"monthly": {"id": "price_1IgowHJNcmPzuWtRzD7SgAYb", "price": "9,99 €", "total": None, "saving": None},
},
"hu": { # Hungarian
"12-month": {"id": "price_1N7PF1JNcmPzuWtRujxNI9yh", "price": "4,99 €", "total": "59,88 €", "saving": 50},
"monthly": {"id": "price_1N7PFbJNcmPzuWtRlVNtHvgG", "price": "9,99 €", "total": None, "saving": None},
},
"it": { # Italian
"12-month": {"id": "price_1J4owvJNcmPzuWtRomVhWQFq", "price": "4,99 €", "total": "59,88 €", "saving": 50},
"monthly": {"id": "price_1J5J6iJNcmPzuWtRK5zfoguV", "price": "9,99 €", "total": None, "saving": None},
Expand All @@ -95,24 +97,12 @@
"monthly": {"id": "price_1N7PN6JNcmPzuWtRpN8HAr7L", "price": "9,99 €", "total": None, "saving": None},
},
},
"huf": { # Hungarian forint
"hu": { # Hungarian
"12-month": {"id": "price_1N7PF1JNcmPzuWtRujxNI9yh", "price": "1,850 Ft", "total": "22,200 Ft", "saving": 50},
"monthly": {"id": "price_1N7PFbJNcmPzuWtRlVNtHvgG", "price": "3,700 Ft", "total": None, "saving": None},
},
},
"pln": { # Polish złoty
"en": { # English
"12-month": {"id": "price_1N7P8TJNcmPzuWtRI7pI29bO", "price": "22 zł", "total": "264 zł", "saving": 48},
"monthly": {"id": "price_1N7P98JNcmPzuWtRbUaI24OH", "price": "45 zł", "total": None, "saving": None},
},
},
"ron": { # Romanian leu
"en": { # English
"12-month": {"id": "price_1N7PADJNcmPzuWtRxHjlrDiy", "price": "lei 25", "total": "lei 300", "saving": 50},
"monthly": {"id": "price_1N7PAmJNcmPzuWtR1zOoPIao", "price": "lei 50", "total": None, "saving": None},
},
},
"usd": { # US dollar
"en": { # English
"12-month": {
Expand All @@ -132,7 +122,7 @@
"default": TEST_VPN_PLAN_ID_MATRIX["euro"]["de"],
},
"BG": { # Bulgaria
"default": TEST_VPN_PLAN_ID_MATRIX["bgn"]["en"],
"default": TEST_VPN_PLAN_ID_MATRIX["euro"]["en"],
},
"BE": { # Belgium
"default": TEST_VPN_PLAN_ID_MATRIX["euro"]["nl"],
Expand All @@ -149,7 +139,7 @@
"el": TEST_VPN_PLAN_ID_MATRIX["euro"]["el"],
},
"CZ": { # Czech Republic
"default": TEST_VPN_PLAN_ID_MATRIX["czk"]["cz"],
"default": TEST_VPN_PLAN_ID_MATRIX["czk"]["cs"],
},
"DE": { # Germany
"default": TEST_VPN_PLAN_ID_MATRIX["euro"]["de"],
Expand All @@ -173,7 +163,7 @@
"default": TEST_VPN_PLAN_ID_MATRIX["euro"]["en"],
},
"HU": { # Hungary
"default": TEST_VPN_PLAN_ID_MATRIX["huf"]["hu"],
"default": TEST_VPN_PLAN_ID_MATRIX["euro"]["hu"],
},
"IE": { # Ireland
"default": TEST_VPN_PLAN_ID_MATRIX["euro"]["en"],
Expand Down Expand Up @@ -204,7 +194,7 @@
"default": TEST_VPN_PLAN_ID_MATRIX["euro"]["pt"],
},
"RO": { # Romania
"default": TEST_VPN_PLAN_ID_MATRIX["ron"]["en"],
"default": TEST_VPN_PLAN_ID_MATRIX["euro"]["en"],
},
"SE": { # Sweden
"default": TEST_VPN_PLAN_ID_MATRIX["euro"]["en"],
Expand Down Expand Up @@ -734,7 +724,7 @@ def test_vpn_subscribe_link_variable_12_month_bg_en(self):
country_code="BG",
lang="en-US",
)
self.assertIn("?plan=price_1N7PGEJNcmPzuWtRzTe85nzw", markup)
self.assertIn("?plan=price_1JcdvBJNcmPzuWtROLbEH9d2", markup)

def test_vpn_subscribe_link_variable_monthly_bg_en(self):
"""Should contain expected monthly plan ID (BG / en-US)"""
Expand All @@ -743,7 +733,7 @@ def test_vpn_subscribe_link_variable_monthly_bg_en(self):
country_code="BG",
lang="en-US",
)
self.assertIn("?plan=price_1N7PHRJNcmPzuWtRjZ8D8kwx", markup)
self.assertIn("?plan=price_1JcdsSJNcmPzuWtRGF9Y5TMJ", markup)

def test_vpn_subscribe_link_variable_12_month_cy_el(self):
"""Should contain expected 12-month plan ID (CY / el)"""
Expand Down Expand Up @@ -781,21 +771,21 @@ def test_vpn_subscribe_link_variable_monthly_cy_en(self):
)
self.assertIn("?plan=price_1JcdsSJNcmPzuWtRGF9Y5TMJ", markup)

def test_vpn_subscribe_link_variable_12_month_cz_cz(self):
"""Should contain expected 12-month plan ID (CZ / cz)"""
def test_vpn_subscribe_link_variable_12_month_cz_cs(self):
"""Should contain expected 12-month plan ID (CZ / cs)"""
markup = self._render(
plan="12-month",
country_code="CZ",
lang="cz",
lang="cs",
)
self.assertIn("?plan=price_1N7PDwJNcmPzuWtR1IxSkZ0c", markup)

def test_vpn_subscribe_link_variable_monthly_cz_cz(self):
"""Should contain expected monthly plan ID (CZ / cz)"""
def test_vpn_subscribe_link_variable_monthly_cz_cs(self):
"""Should contain expected monthly plan ID (CZ / cs)"""
markup = self._render(
plan="monthly",
country_code="CZ",
lang="cz",
lang="cs",
)
self.assertIn("?plan=price_1N7PESJNcmPzuWtRTgmv8Ve4", markup)

Expand Down Expand Up @@ -860,7 +850,7 @@ def test_vpn_subscribe_link_variable_12_month_ro_en(self):
country_code="RO",
lang="en-US",
)
self.assertIn("?plan=price_1N7PADJNcmPzuWtRxHjlrDiy", markup)
self.assertIn("?plan=price_1JcdvBJNcmPzuWtROLbEH9d2", markup)

def test_vpn_subscribe_link_variable_monthly_ro_en(self):
"""Should contain expected monthly plan ID (RO / en-US)"""
Expand All @@ -869,7 +859,7 @@ def test_vpn_subscribe_link_variable_monthly_ro_en(self):
country_code="RO",
lang="en-US",
)
self.assertIn("?plan=price_1N7PAmJNcmPzuWtR1zOoPIao", markup)
self.assertIn("?plan=price_1JcdsSJNcmPzuWtRGF9Y5TMJ", markup)

def test_vpn_subscribe_link_variable_12_month_ee_en(self):
"""Should contain expected 12-month plan ID (EE / en-US)"""
Expand Down Expand Up @@ -1055,18 +1045,6 @@ def test_vpn_12_month_price_chf(self):
expected = '<span class="vpn-monthly-price-display">CHF 5.99<span>/month</span></span>'
self.assertEqual(markup, expected)

def test_vpn_monthly_price_bgn(self):
"""Should return expected markup"""
markup = self._render(plan="monthly", country_code="BG", lang="en-US")
expected = '<span class="vpn-monthly-price-display">20 лв<span>/month</span></span>'
self.assertEqual(markup, expected)

def test_vpn_12_month_price_bgn(self):
"""Should return expected markup"""
markup = self._render(plan="12-month", country_code="BG", lang="en-US")
expected = '<span class="vpn-monthly-price-display">10 лв<span>/month</span></span>'
self.assertEqual(markup, expected)

def test_vpn_monthly_price_czk(self):
"""Should return expected markup"""
markup = self._render(plan="monthly", country_code="CZ", lang="en-US")
Expand All @@ -1091,18 +1069,6 @@ def test_vpn_12_month_price_dkk(self):
expected = '<span class="vpn-monthly-price-display">kr. 37<span>/month</span></span>'
self.assertEqual(markup, expected)

def test_vpn_monthly_price_huf(self):
"""Should return expected markup"""
markup = self._render(plan="monthly", country_code="HU", lang="hu")
expected = '<span class="vpn-monthly-price-display">3,700 Ft<span>/month</span></span>'
self.assertEqual(markup, expected)

def test_vpn_12_month_price_huf(self):
"""Should return expected markup"""
markup = self._render(plan="12-month", country_code="HU", lang="hu")
expected = '<span class="vpn-monthly-price-display">1,850 Ft<span>/month</span></span>'
self.assertEqual(markup, expected)

def test_vpn_monthly_price_pln(self):
"""Should return expected markup"""
markup = self._render(plan="monthly", country_code="PL", lang="en-US")
Expand All @@ -1115,18 +1081,6 @@ def test_vpn_12_month_price_pln(self):
expected = '<span class="vpn-monthly-price-display">22 zł<span>/month</span></span>'
self.assertEqual(markup, expected)

def test_vpn_monthly_price_ron(self):
"""Should return expected markup"""
markup = self._render(plan="monthly", country_code="RO", lang="en-US")
expected = '<span class="vpn-monthly-price-display">lei 50<span>/month</span></span>'
self.assertEqual(markup, expected)

def test_vpn_12_month_price_ron(self):
"""Should return expected markup"""
markup = self._render(plan="12-month", country_code="RO", lang="en-US")
expected = '<span class="vpn-monthly-price-display">lei 25<span>/month</span></span>'
self.assertEqual(markup, expected)


@override_settings(
VPN_VARIABLE_PRICING=TEST_VPN_VARIABLE_PRICING,
Expand Down Expand Up @@ -1164,15 +1118,9 @@ def test_vpn_12_month_total_price_chf(self):
expected = "CHF 71.88 total"
self.assertEqual(markup, expected)

def test_vpn_12_month_total_price_bgn(self):
"""Should return expected markup"""
markup = self._render(country_code="BG", lang="en-US")
expected = "120 лв total"
self.assertEqual(markup, expected)

def test_vpn_12_month_total_price_czk(self):
"""Should return expected markup"""
markup = self._render(country_code="CZ", lang="cz")
markup = self._render(country_code="CZ", lang="cs")
expected = "1,428 Kč total"
self.assertEqual(markup, expected)

Expand All @@ -1182,24 +1130,12 @@ def test_vpn_12_month_total_price_dkk(self):
expected = "kr. 444 total"
self.assertEqual(markup, expected)

def test_vpn_12_month_total_price_huf(self):
"""Should return expected markup"""
markup = self._render(country_code="HU", lang="hu")
expected = "22,200 Ft total"
self.assertEqual(markup, expected)

def test_vpn_12_month_total_price_pln(self):
"""Should return expected markup"""
markup = self._render(country_code="PL", lang="en-US")
expected = "264 zł total"
self.assertEqual(markup, expected)

def test_vpn_12_month_total_price_ron(self):
"""Should return expected markup"""
markup = self._render(country_code="RO", lang="en-US")
expected = "lei 300 total"
self.assertEqual(markup, expected)

def test_vpn_relay_bundle_12_month_total_price_usd(self):
"""Should return expected markup"""
markup = self._render(country_code="US", lang="en-US", bundle_relay=True)
Expand Down
Loading

0 comments on commit 736b9a5

Please sign in to comment.