Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VPN wave VI expansion post-launch cleanup (Fixes #13552) #13580

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 2 additions & 69 deletions bedrock/firefox/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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")
Expand All @@ -528,59 +506,14 @@ 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"
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_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"""
Expand Down
24 changes: 22 additions & 2 deletions bedrock/firefox/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 0 additions & 4 deletions bedrock/products/templates/products/vpn/includes/macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,7 @@ <h2 class="vpn-hero-sub-heading">{{ subheading }}</h2>
</a>

<p class="availability-copy">
{% 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 %}
</p>
{% endif %}
{%- endmacro %}
Expand Down
8 changes: 0 additions & 8 deletions bedrock/products/templates/products/vpn/landing.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,7 @@
</a>

<p class="availability-copy">
{% 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 %}
</p>
{% endcall %}
{% endif %}
Expand Down Expand Up @@ -242,11 +238,7 @@
</a>

<p class="availability-copy">
{% 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 %}
</p>
</div>
<div class="l-column-last">
Expand Down
4 changes: 0 additions & 4 deletions bedrock/products/templates/products/vpn/pricing.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,7 @@ <h1 class="mzp-c-wordmark mzp-t-wordmark-lg mzp-t-product-vpn">{{ ftl('vpn-share
</a>

<p class="availability-copy">
{% 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 %}
</p>
{% endcall %}
{% endif %}
Expand Down
9 changes: 0 additions & 9 deletions bedrock/products/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 1 addition & 5 deletions bedrock/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down