From db3b2c3359d79971eae933e77e4f77c19e226bd2 Mon Sep 17 00:00:00 2001 From: Alex Gibson Date: Wed, 16 Aug 2023 10:42:12 +0100 Subject: [PATCH] VPN wave VI expansion post-launch cleanup (Fixes #13552) --- bedrock/firefox/tests/test_base.py | 71 +------------------ bedrock/firefox/views.py | 24 ++++++- .../products/vpn/includes/macros.html | 4 -- .../templates/products/vpn/landing.html | 8 --- .../templates/products/vpn/pricing.html | 4 -- bedrock/products/views.py | 9 --- bedrock/settings/base.py | 6 +- 7 files changed, 25 insertions(+), 101 deletions(-) diff --git a/bedrock/firefox/tests/test_base.py b/bedrock/firefox/tests/test_base.py index 21d8ea01e43..e1c14f8cdc7 100644 --- a/bedrock/firefox/tests/test_base.py +++ b/bedrock/firefox/tests/test_base.py @@ -488,8 +488,7 @@ def test_fx_115_0_0_en_us_windows(self, render_mock): assert template == ["firefox/whatsnew/whatsnew-fx115-na-windows.html"] @override_settings(DEV=True) - @patch.dict(os.environ, SWITCH_VPN_WAVE_VI="True") - def test_fx_115_0_0_en_bg_switch_on(self, render_mock): + def test_fx_115_0_0_en_bg(self, render_mock): """Should use whatsnew-fx115-eu-vpn template for en-US locale in Bulgaria if switch is on""" req = self.rf.get("/firefox/whatsnew/", HTTP_CF_IPCOUNTRY="BG") req.locale = "en-US" @@ -498,27 +497,6 @@ def test_fx_115_0_0_en_bg_switch_on(self, render_mock): assert template == ["firefox/whatsnew/whatsnew-fx115-eu-vpn.html"] @override_settings(DEV=True) - @patch.dict(os.environ, SWITCH_VPN_WAVE_VI="False") - def test_fx_115_0_0_en_bg_switch_off(self, render_mock): - """Should use whatsnew-fx115-na-addons template for en-US locale in Bulgaria if switch is off""" - req = self.rf.get("/firefox/whatsnew/", HTTP_CF_IPCOUNTRY="BG") - req.locale = "en-US" - self.view(req, version="115.0") - template = render_mock.call_args[0][1] - assert template == ["firefox/whatsnew/whatsnew-fx115-na-addons.html"] - - @override_settings(DEV=True) - @patch.dict(os.environ, SWITCH_VPN_WAVE_VI="False") - def test_fx_115_0_0_bg_bg_switch_off(self, render_mock): - """Should use standard template for bg locale in Bulgaria if switch is off""" - req = self.rf.get("/firefox/whatsnew/", HTTP_CF_IPCOUNTRY="BG") - req.locale = "bg" - self.view(req, version="115.0") - template = render_mock.call_args[0][1] - assert template == ["firefox/whatsnew/index.html"] - - @override_settings(DEV=True) - @patch.dict(os.environ, SWITCH_VPN_WAVE_VI="True") def test_fx_115_0_0_bg_us(self, render_mock): """Should use standard template for bg locale in USA""" req = self.rf.get("/firefox/whatsnew/", HTTP_CF_IPCOUNTRY="US") @@ -528,30 +506,7 @@ def test_fx_115_0_0_bg_us(self, render_mock): assert template == ["firefox/whatsnew/index.html"] @override_settings(DEV=True) - @patch.dict(os.environ, SWITCH_VPN_WAVE_VI="True") - @patch.object(fx_views, "ftl_file_is_active", lambda *x: True) - def test_fx_115_0_0_hu_hu_switch_on(self, render_mock): - """Should use whatsnew-fx115-eu-vpn template for hu locale in Hungary if switch is on""" - req = self.rf.get("/firefox/whatsnew/", HTTP_CF_IPCOUNTRY="HU") - req.locale = "hu" - self.view(req, version="115.0") - template = render_mock.call_args[0][1] - assert template == ["firefox/whatsnew/whatsnew-fx115-eu-vpn.html"] - - @override_settings(DEV=True) - @patch.dict(os.environ, SWITCH_VPN_WAVE_VI="False") - @patch.object(fx_views, "ftl_file_is_active", lambda *x: True) - def test_fx_115_0_0_hu_hu_switch_off(self, render_mock): - """Should use standard template for hu locale in Hungary if switch is off""" - req = self.rf.get("/firefox/whatsnew/", HTTP_CF_IPCOUNTRY="HU") - req.locale = "hu" - self.view(req, version="115.0") - template = render_mock.call_args[0][1] - assert template == ["firefox/whatsnew/index.html"] - - @override_settings(DEV=True) - @patch.dict(os.environ, SWITCH_VPN_WAVE_VI="True") - def test_fx_115_0_0_en_hu_switch_on(self, render_mock): + def test_fx_115_0_0_en_hu(self, render_mock): """Should use whatsnew-fx115-eu-vpn template for en-US locale in Hungary if switch is on""" req = self.rf.get("/firefox/whatsnew/", HTTP_CF_IPCOUNTRY="HU") req.locale = "en-US" @@ -559,28 +514,6 @@ def test_fx_115_0_0_en_hu_switch_on(self, render_mock): template = render_mock.call_args[0][1] assert template == ["firefox/whatsnew/whatsnew-fx115-eu-vpn.html"] - @override_settings(DEV=True) - @patch.dict(os.environ, SWITCH_VPN_WAVE_VI="False") - @patch.object(fx_views, "ftl_file_is_active", lambda *x: True) - def test_fx_115_0_0_en_hu_switch_off(self, render_mock): - """Should use whatsnew-fx115-na-addons template for en-US locale in Hungary if switch is off""" - req = self.rf.get("/firefox/whatsnew/", HTTP_CF_IPCOUNTRY="HU") - req.locale = "en-US" - self.view(req, version="115.0") - template = render_mock.call_args[0][1] - assert template == ["firefox/whatsnew/whatsnew-fx115-na-addons.html"] - - @override_settings(DEV=True) - @patch.dict(os.environ, SWITCH_VPN_WAVE_VI="True") - @patch.object(fx_views, "ftl_file_is_active", lambda *x: True) - def test_fx_115_0_0_el_cy_switch_on(self, render_mock): - """Should use whatsnew-fx115-eu-vpn template for el locale in Cyprus if switch is on""" - req = self.rf.get("/firefox/whatsnew/", HTTP_CF_IPCOUNTRY="CY") - req.locale = "el" - self.view(req, version="115.0") - template = render_mock.call_args[0][1] - assert template == ["firefox/whatsnew/whatsnew-fx115-eu-vpn.html"] - @override_settings(DEV=True) def test_fx_115_0_0_de(self, render_mock): """Should use whatsnew-fx115-eu-ctd-de template for de locale""" diff --git a/bedrock/firefox/views.py b/bedrock/firefox/views.py index ed68a5b168f..bfdf59ae495 100644 --- a/bedrock/firefox/views.py +++ b/bedrock/firefox/views.py @@ -475,6 +475,26 @@ def get_template_names(self): channel = detect_channel(version) + # Used by WNP 115 + vpn_wave_vi_countries = [ + "BG", # Bulgaria + "CY", # Cyprus + "CZ", # Czech Republic + "DK", # Denmark + "EE", # Estonia + "HR", # Croatia + "HU", # Hungary + "LT", # Lithuania + "LU", # Luxembourg + "LV", # Latvia + "MT", # Malta + "PL", # Poland + "PT", # Portugal + "RO", # Romania + "SI", # Slovenia + "SK", # Slovakia + ] + if channel == "nightly": template = "firefox/nightly/whatsnew.html" elif channel == "developer": @@ -519,11 +539,11 @@ def get_template_names(self): template = "firefox/whatsnew/whatsnew-fx115-eu-mobile-uk.html" elif country == "GB": template = "firefox/whatsnew/whatsnew-fx115-eu-mobile-uk.html" - elif switch("vpn-wave-vi") and country in settings.VPN_COUNTRY_CODES_WAVE_VI: + elif country in vpn_wave_vi_countries: template = "firefox/whatsnew/whatsnew-fx115-eu-vpn.html" else: template = "firefox/whatsnew/whatsnew-fx115-na-addons.html" - elif switch("vpn-wave-vi") and country in settings.VPN_COUNTRY_CODES_WAVE_VI: + elif country in vpn_wave_vi_countries: template = "firefox/whatsnew/whatsnew-fx115-eu-vpn.html" elif locale == "de": template = "firefox/whatsnew/whatsnew-fx115-eu-ctd-de.html" diff --git a/bedrock/products/templates/products/vpn/includes/macros.html b/bedrock/products/templates/products/vpn/includes/macros.html index 0cf0982cb8c..5e40cf3d93c 100644 --- a/bedrock/products/templates/products/vpn/includes/macros.html +++ b/bedrock/products/templates/products/vpn/includes/macros.html @@ -108,11 +108,7 @@

{{ subheading }}

- {% if switch('vpn-wave-vi') %} {{ ftl('vpn-shared-available-countries-v6', fallback='vpn-shared-available-countries-v5') }} - {% else %} - {{ ftl('vpn-shared-available-countries-v5') }} - {% endif %}

{% endif %} {%- endmacro %} diff --git a/bedrock/products/templates/products/vpn/landing.html b/bedrock/products/templates/products/vpn/landing.html index b7c6fb4539d..25756a727e2 100644 --- a/bedrock/products/templates/products/vpn/landing.html +++ b/bedrock/products/templates/products/vpn/landing.html @@ -188,11 +188,7 @@

- {% if switch('vpn-wave-vi') %} {{ ftl('vpn-shared-available-countries-v6', fallback='vpn-shared-available-countries-v5') }} - {% else %} - {{ ftl('vpn-shared-available-countries-v5') }} - {% endif %}

{% endcall %} {% endif %} @@ -242,11 +238,7 @@

- {% if switch('vpn-wave-vi') %} {{ ftl('vpn-shared-available-countries-v6', fallback='vpn-shared-available-countries-v5') }} - {% else %} - {{ ftl('vpn-shared-available-countries-v5') }} - {% endif %}

diff --git a/bedrock/products/templates/products/vpn/pricing.html b/bedrock/products/templates/products/vpn/pricing.html index 1bb83494d75..477f243b44e 100644 --- a/bedrock/products/templates/products/vpn/pricing.html +++ b/bedrock/products/templates/products/vpn/pricing.html @@ -73,11 +73,7 @@

{{ ftl('vpn-share

- {% if switch('vpn-wave-vi') %} {{ ftl('vpn-shared-available-countries-v6', fallback='vpn-shared-available-countries-v5') }} - {% else %} - {{ ftl('vpn-shared-available-countries-v5') }} - {% endif %}

{% endcall %} {% endif %} diff --git a/bedrock/products/views.py b/bedrock/products/views.py index 5eb4b3432f4..bd3ef41f31e 100644 --- a/bedrock/products/views.py +++ b/bedrock/products/views.py @@ -34,9 +34,6 @@ def vpn_available(request): country = get_country_from_request(request) country_list = settings.VPN_COUNTRY_CODES - if switch("vpn-wave-vi"): - country_list = settings.VPN_COUNTRY_CODES + settings.VPN_COUNTRY_CODES_WAVE_VI - return country in country_list @@ -80,9 +77,6 @@ def vpn_landing_page(request): else: template_name = "products/vpn/landing.html" - if switch("vpn-wave-vi"): - available_countries = settings.VPN_AVAILABLE_COUNTRIES_WAVE_VI - context = { "vpn_available": vpn_available_in_country, "available_countries": available_countries, @@ -111,9 +105,6 @@ def vpn_pricing_page(request): if variant not in ["1", "2"]: variant = None - if switch("vpn-wave-vi"): - available_countries = settings.VPN_AVAILABLE_COUNTRIES_WAVE_VI - context = { "vpn_available": vpn_available_in_country, "available_countries": available_countries, diff --git a/bedrock/settings/base.py b/bedrock/settings/base.py index eefb4697f9e..154bba9b7fd 100644 --- a/bedrock/settings/base.py +++ b/bedrock/settings/base.py @@ -1656,9 +1656,6 @@ def before_send(event, hint): "NL", # Netherlands "SE", # Sweden "FI", # Finland -] - -VPN_COUNTRY_CODES_WAVE_VI = [ "BG", # Bulgaria "CY", # Cyprus "CZ", # Czech Republic @@ -1676,10 +1673,9 @@ def before_send(event, hint): "SI", # Slovenia "SK", # Slovakia ] -VPN_AVAILABLE_COUNTRIES_WAVE_VI = 33 VPN_AFFILIATE_COUNTRIES = ["CA", "DE", "FR", "GB", "IE", "US"] -VPN_AVAILABLE_COUNTRIES = 17 +VPN_AVAILABLE_COUNTRIES = 33 VPN_CONNECT_SERVERS = 500 VPN_CONNECT_COUNTRIES = 30 VPN_CONNECT_DEVICES = 5