remove REGION_STORES setting (bug 794717)
This commit is contained in:
Родитель
7251c9eb30
Коммит
992ba595b8
|
@ -58,7 +58,7 @@ def babel_datetime(t, format='medium'):
|
|||
@register.function
|
||||
def locale_url(url):
|
||||
"""Take a URL and give it the locale prefix."""
|
||||
if settings.MARKETPLACE and settings.REGION_STORES:
|
||||
if settings.MARKETPLACE:
|
||||
return url
|
||||
prefixer = urlresolvers.get_url_prefix()
|
||||
script = prefixer.request.META['SCRIPT_NAME']
|
||||
|
|
|
@ -244,12 +244,8 @@ class LoginRequiredMiddleware(ViewMiddleware):
|
|||
name.startswith(settings.NO_LOGIN_REQUIRED_MODULES)):
|
||||
return
|
||||
if settings.MARKETPLACE:
|
||||
if settings.REGION_STORES:
|
||||
# Redirect to /login if we're not logged in.
|
||||
redirect_url = settings.LOGIN_URL
|
||||
else:
|
||||
# Redirect to /en-US/login if we're not logged in.
|
||||
redirect_url = '/%s%s' % (request.LANG, settings.LOGIN_URL)
|
||||
# Redirect to /login if we're not logged in.
|
||||
redirect_url = settings.LOGIN_URL
|
||||
path_info = request.path_info
|
||||
if path_info.lstrip('/') and path_info != settings.LOGIN_URL:
|
||||
redirect_url = urlparams(redirect_url, to=request.path)
|
||||
|
|
|
@ -54,7 +54,7 @@ def reverse(viewname, urlconf=None, args=None, kwargs=None, prefix=None,
|
|||
current_app=None, add_prefix=True):
|
||||
"""Wraps django's reverse to prepend the correct locale and app."""
|
||||
prefixer = get_url_prefix()
|
||||
if settings.MARKETPLACE and settings.REGION_STORES:
|
||||
if settings.MARKETPLACE:
|
||||
prefix = None
|
||||
# Blank out the script prefix since we add that in prefixer.fix().
|
||||
if prefixer:
|
||||
|
@ -145,7 +145,7 @@ class Prefixer(object):
|
|||
|
||||
def fix(self, path):
|
||||
# Marketplace URLs are not prefixed with `/<locale>/<app>`.
|
||||
if settings.MARKETPLACE and settings.REGION_STORES:
|
||||
if settings.MARKETPLACE:
|
||||
return path
|
||||
|
||||
path = path.lstrip('/')
|
||||
|
|
|
@ -160,9 +160,7 @@ NOTIFICATION_GROUPS = {'dev': _('Developer'),
|
|||
'user': _('User Notifications')}
|
||||
|
||||
APP_NOTIFICATIONS = [app_reply, app_new_review, app_reviewed,
|
||||
app_individual_contact, app_surveys]
|
||||
if getattr(settings, 'REGION_STORES', False):
|
||||
APP_NOTIFICATIONS.append(app_regions)
|
||||
app_individual_contact, app_surveys, app_regions]
|
||||
APP_NOTIFICATIONS_BY_ID = dict((l.id, l) for l in APP_NOTIFICATIONS)
|
||||
APP_NOTIFICATIONS_DEFAULT = [l.id for l in APP_NOTIFICATIONS]
|
||||
APP_NOTIFICATIONS_CHOICES = [(l.id, l.label) for l in APP_NOTIFICATIONS]
|
||||
|
|
|
@ -1483,9 +1483,6 @@ SOLITUDE_TIMEOUT = 10
|
|||
# support it natively.
|
||||
SIMULATE_NAV_PAY = False
|
||||
|
||||
# Set this to True if you want region stores (eg: marketplace).
|
||||
REGION_STORES = False
|
||||
|
||||
# When the dev. agreement gets updated and you need users to re-accept it
|
||||
# change this date. You won't want to do this for minor format changes.
|
||||
# The tuple is passed through to datetime.date, so please use a valid date
|
||||
|
|
|
@ -43,24 +43,22 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{% if settings.REGION_STORES %}
|
||||
<div class="simple-field c">
|
||||
<div class="form-label">
|
||||
<label for="region">{{ _('Region') }}</label>
|
||||
</div>
|
||||
<div class="form-col">
|
||||
{% if DESKTOP %}<div class="styled select input">{% endif %}
|
||||
<select id="region" name="region">
|
||||
{% for code, region in mkt.regions.REGIONS_CHOICES_SLUG -%}
|
||||
<option value="{{ code }}"{% if code == request.REGION.slug %}
|
||||
selected{% endif %}>
|
||||
{{ region.name }}</option>
|
||||
{%- endfor %}
|
||||
</select>
|
||||
{% if DESKTOP %}</div>{% endif %}
|
||||
</div>
|
||||
<div class="simple-field c">
|
||||
<div class="form-label">
|
||||
<label for="region">{{ _('Region') }}</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="form-col">
|
||||
{% if DESKTOP %}<div class="styled select input">{% endif %}
|
||||
<select id="region" name="region">
|
||||
{% for code, region in mkt.regions.REGIONS_CHOICES_SLUG -%}
|
||||
<option value="{{ code }}"{% if code == request.REGION.slug %}
|
||||
selected{% endif %}>
|
||||
{{ region.name }}</option>
|
||||
{%- endfor %}
|
||||
</select>
|
||||
{% if DESKTOP %}</div>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if 'admin_log' in form.fields %}
|
||||
<h3>Administration</h3>
|
||||
|
|
|
@ -221,7 +221,6 @@ class TestAccountSettings(amo.tests.TestCase):
|
|||
assert delete_photo_task.delay.called
|
||||
|
||||
def test_lang_region_selector(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
r = self.client.get(self.url)
|
||||
doc = pq(r.content)
|
||||
eq_(r.status_code, 200)
|
||||
|
@ -725,7 +724,6 @@ class TestPurchases(PurchaseBase):
|
|||
assert '$1.00' in self.get_pq()('.purchase').eq(0).text()
|
||||
|
||||
def test_price_locale(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
purchases = self.get_pq(lang='fr')
|
||||
assert u'1,00' in purchases('.purchase').eq(0).text()
|
||||
|
||||
|
|
|
@ -589,7 +589,6 @@ class TestCategoryHandler(BaseOAuth):
|
|||
eq_(data['name'], 'Webapp')
|
||||
|
||||
def test_get_category_localised(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
res = self.client.get(self.get_url, HTTP_ACCEPT_LANGUAGE='fr')
|
||||
data = json.loads(res.content)
|
||||
eq_(data['name'], 'Le Webapp')
|
||||
|
|
|
@ -41,8 +41,6 @@ class BrowseBase(amo.tests.ESTestCase):
|
|||
return f
|
||||
|
||||
def setup_featured(self, num=3):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
|
||||
# Category featured.
|
||||
a = amo.tests.app_factory()
|
||||
self.make_featured(app=a, category=self.cat)
|
||||
|
@ -78,7 +76,6 @@ class BrowseBase(amo.tests.ESTestCase):
|
|||
# way, pun-wise or code-wise, please don't hesitate to do so.] In the
|
||||
# meantime, SkipTest is the rubber band to our elastic problems.)
|
||||
raise SkipTest
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
|
||||
# Popular for this category.
|
||||
a = amo.tests.app_factory()
|
||||
|
|
|
@ -18,8 +18,6 @@ class TestCarrierURLs(TestCase):
|
|||
fixtures = ['base/users']
|
||||
|
||||
def setUp(self):
|
||||
if not settings.REGION_STORES:
|
||||
raise SkipTest()
|
||||
if not settings.USE_CARRIER_URLS:
|
||||
raise SkipTest()
|
||||
set_carrier(None)
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% if settings.REGION_STORES %}
|
||||
<tr>
|
||||
<th>
|
||||
{{ tip(_('Regions'),
|
||||
|
@ -103,7 +102,6 @@
|
|||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr>
|
||||
<th>
|
||||
<label data-for="homepage">
|
||||
|
|
|
@ -77,7 +77,6 @@ class TestRegionForm(amo.tests.WebappTestCase):
|
|||
super(TestRegionForm, self).setUp()
|
||||
self.request = RequestFactory()
|
||||
self.kwargs = {'product': self.app}
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
|
||||
def test_initial_empty(self):
|
||||
form = forms.RegionForm(data=None, **self.kwargs)
|
||||
|
|
|
@ -519,10 +519,6 @@ class TestFetchIcon(BaseWebAppTest):
|
|||
|
||||
class TestRegionEmail(amo.tests.WebappTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestRegionEmail, self).setUp()
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
|
||||
@mock.patch.object(settings, 'SITE_URL', 'http://omg.org/yes')
|
||||
def test_email_for_one_new_region(self):
|
||||
tasks.region_email([self.app.id], [mkt.regions.CA])
|
||||
|
|
|
@ -79,7 +79,6 @@ class TestHome(amo.tests.TestCase):
|
|||
assert got.endswith(exp), 'Expected %s. Got %s.' % (exp, got)
|
||||
|
||||
def test_login_redirect(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
r = self.client.get(self.url)
|
||||
self.assertLoginRedirects(r, '/developers/submissions', 302)
|
||||
|
||||
|
@ -719,7 +718,6 @@ class TestUpload(BaseUploadTest):
|
|||
return self.client.post(self.url, {'upload': data})
|
||||
|
||||
def test_login_required(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
self.client.logout()
|
||||
r = self.post()
|
||||
eq_(r.status_code, 302)
|
||||
|
|
|
@ -504,7 +504,6 @@ class TestEditBasic(TestEdit):
|
|||
'l10n menu not visible for %s' % url)
|
||||
|
||||
def test_l10n_not_us_id_url(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
self.webapp.update(default_locale='fr')
|
||||
for url in self.get_l10n_urls():
|
||||
r = self.client.get('/id' + url, follow=True)
|
||||
|
@ -1012,9 +1011,8 @@ class TestEditDetails(TestEdit):
|
|||
default_locale='en-US',
|
||||
homepage='http://twitter.com/fligtarsmom',
|
||||
privacy_policy="fligtar's mom does <em>not</em> share "
|
||||
"your data with third parties.")
|
||||
if settings.REGION_STORES:
|
||||
data['regions'] = [mkt.regions.CA.id]
|
||||
"your data with third parties.",
|
||||
regions=[mkt.regions.CA.id])
|
||||
data.update(kw)
|
||||
return data
|
||||
|
||||
|
@ -1123,14 +1121,12 @@ class TestEditDetails(TestEdit):
|
|||
self.assertFormError(r, 'form', 'homepage', 'Enter a valid URL.')
|
||||
|
||||
def test_regions_listed(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
r = self.client.get(self.url)
|
||||
eq_(strip_whitespace(pq(r.content)('#regions').text()),
|
||||
', '.join(sorted(unicode(name) for id_, name in
|
||||
mkt.regions.REGIONS_CHOICES_NAME)))
|
||||
|
||||
def test_excluded_regions_not_listed(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
AER.objects.create(addon=self.webapp, region=mkt.regions.BR.id)
|
||||
|
||||
# This looks at the included regions and prints out the names
|
||||
|
@ -1144,7 +1140,6 @@ class TestEditDetails(TestEdit):
|
|||
', '.join(expected))
|
||||
|
||||
def test_excluded_all_regions_not_listed(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
for region in mkt.regions.ALL_REGION_IDS:
|
||||
AER.objects.create(addon=self.webapp, region=region)
|
||||
|
||||
|
@ -1152,7 +1147,6 @@ class TestEditDetails(TestEdit):
|
|||
eq_(pq(r.content)('#regions .empty').length, 1)
|
||||
|
||||
def test_exclude_region(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
regions = list(mkt.regions.REGION_IDS)
|
||||
for region_id in regions:
|
||||
to_exclude = list(regions)
|
||||
|
@ -1164,7 +1158,6 @@ class TestEditDetails(TestEdit):
|
|||
eq_(self.get_excluded_ids(), [region_id])
|
||||
|
||||
def test_exclude_future_regions(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
data = self.get_dict(regions=mkt.regions.REGION_IDS,
|
||||
other_regions=False)
|
||||
r = self.client.post(self.edit_url, data)
|
||||
|
@ -1173,7 +1166,6 @@ class TestEditDetails(TestEdit):
|
|||
eq_(self.get_excluded_ids(), [mkt.regions.WORLDWIDE.id])
|
||||
|
||||
def test_include_regions(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
AER.objects.create(addon=self.webapp, region=mkt.regions.BR.id)
|
||||
|
||||
data = self.get_dict(regions=mkt.regions.REGION_IDS,
|
||||
|
@ -1184,7 +1176,6 @@ class TestEditDetails(TestEdit):
|
|||
eq_(self.get_excluded_ids(), [])
|
||||
|
||||
def test_include_future_regions(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
AER.objects.create(addon=self.webapp, region=mkt.regions.WORLDWIDE.id)
|
||||
|
||||
data = self.get_dict(regions=mkt.regions.REGION_IDS,
|
||||
|
@ -1195,7 +1186,6 @@ class TestEditDetails(TestEdit):
|
|||
eq_(self.get_excluded_ids(), [])
|
||||
|
||||
def test_include_all_and_future_regions(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
AER.objects.create(addon=self.webapp, region=mkt.regions.WORLDWIDE.id)
|
||||
|
||||
data = self.get_dict(regions=mkt.regions.REGION_IDS,
|
||||
|
@ -1206,8 +1196,6 @@ class TestEditDetails(TestEdit):
|
|||
eq_(self.get_excluded_ids(), [])
|
||||
|
||||
def test_brazil_games_excluded(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
|
||||
games = Category.objects.create(type=amo.ADDON_WEBAPP, slug='games')
|
||||
AddonCategory.objects.create(addon=self.webapp, category=games)
|
||||
|
||||
|
@ -1224,8 +1212,6 @@ class TestEditDetails(TestEdit):
|
|||
eq_(self.get_excluded_ids(), [mkt.regions.BR.id])
|
||||
|
||||
def test_brazil_games_already_excluded(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
|
||||
AER.objects.create(addon=self.webapp, region=mkt.regions.BR.id)
|
||||
games = Category.objects.create(type=amo.ADDON_WEBAPP, slug='games')
|
||||
AddonCategory.objects.create(addon=self.webapp, category=games)
|
||||
|
@ -1238,8 +1224,6 @@ class TestEditDetails(TestEdit):
|
|||
eq_(self.get_excluded_ids(), [mkt.regions.BR.id])
|
||||
|
||||
def test_brazil_games_with_content_rating(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
|
||||
# This game has a government content rating!
|
||||
rb = mkt.regions.BR.ratingsbodies[0]
|
||||
ContentRating.objects.create(addon=self.webapp,
|
||||
|
@ -1256,8 +1240,6 @@ class TestEditDetails(TestEdit):
|
|||
eq_(self.get_excluded_ids(), [])
|
||||
|
||||
def test_brazil_games_form_disabled(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
|
||||
games = Category.objects.create(type=amo.ADDON_WEBAPP, slug='games')
|
||||
AddonCategory.objects.create(addon=self.webapp, category=games)
|
||||
|
||||
|
@ -1270,8 +1252,6 @@ class TestEditDetails(TestEdit):
|
|||
eq_(td.find('.note.disabled-regions').length, 1)
|
||||
|
||||
def test_brazil_games_form_enabled_with_content_rating(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
|
||||
rb = mkt.regions.BR.ratingsbodies[0]
|
||||
ContentRating.objects.create(addon=self.webapp,
|
||||
ratings_body=rb.id, rating=rb.ratings[0].id)
|
||||
|
@ -1288,8 +1268,6 @@ class TestEditDetails(TestEdit):
|
|||
eq_(td.find('.note.disabled-regions').length, 0)
|
||||
|
||||
def test_brazil_other_cats_form_enabled(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
|
||||
r = self.client.get(self.edit_url, self.get_dict())
|
||||
self.assertNoFormErrors(r)
|
||||
|
||||
|
|
|
@ -658,7 +658,7 @@ def addons_section(request, addon_id, addon, section, editable=False,
|
|||
request.POST or None, prefix='files',
|
||||
queryset=addon.get_previews())
|
||||
|
||||
elif section == 'details' and settings.REGION_STORES:
|
||||
elif section == 'details':
|
||||
region_form = RegionForm(request.POST or None, product=addon)
|
||||
|
||||
elif (section == 'admin' and
|
||||
|
|
|
@ -15,7 +15,6 @@ class TestLanding(amo.tests.TestCase):
|
|||
self.url = reverse('ecosystem.landing')
|
||||
|
||||
def test_legacy_redirect(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
r = self.client.get('/ecosystem/')
|
||||
self.assert3xx(r, '/developers/', 301)
|
||||
|
||||
|
|
|
@ -189,7 +189,6 @@ class TestPayStart(PayFlowTest):
|
|||
eq_(rp.context['currency'], currency)
|
||||
|
||||
def test_locale_sets_currency(self, fetch_prod_im):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
currency = 'EUR'
|
||||
self.user.preapprovaluser.delete()
|
||||
payload = self.payload()
|
||||
|
@ -343,7 +342,6 @@ class TestPay(PaymentViewTest):
|
|||
|
||||
@fudge.patch('paypal.get_paykey')
|
||||
def test_no_preapproval_non_us_locale(self, get_paykey):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
self.user.preapprovaluser.delete()
|
||||
payload = self.payload()
|
||||
currency = 'EUR'
|
||||
|
|
|
@ -307,8 +307,6 @@ class TestWebappSearch(PaidAppMixin, SearchBase):
|
|||
302)
|
||||
|
||||
def test_region_exclusions(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
|
||||
AER.objects.create(addon=self.webapp, region=mkt.regions.BR.id)
|
||||
for region in mkt.regions.REGIONS_DICT:
|
||||
self.check_results({'q': 'Steam', 'region': region},
|
||||
|
@ -316,8 +314,6 @@ class TestWebappSearch(PaidAppMixin, SearchBase):
|
|||
|
||||
@mock.patch.object(mkt.regions.BR, 'adolescent', True)
|
||||
def test_adolescent_popularity(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
|
||||
# Adolescent regions use global popularity.
|
||||
|
||||
# Webapp: Global: 0, Regional: 0
|
||||
|
@ -401,8 +397,6 @@ class TestSuggestions(TestAjaxSearch):
|
|||
'q=app&category=', addons=[self.w2])
|
||||
|
||||
def test_region_exclusions(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
|
||||
AER.objects.create(addon=self.w2, region=mkt.regions.BR.id)
|
||||
|
||||
self.check_suggestions(self.url,
|
||||
|
|
|
@ -26,10 +26,6 @@ LOGOUT_URL = '/logout'
|
|||
# Let robots tear this place up.
|
||||
ENGAGE_ROBOTS = True
|
||||
|
||||
# NOTE: If you want to disable this, you have to do it in this file right here
|
||||
# since we do a lot of conditional stuff below.
|
||||
REGION_STORES = True
|
||||
|
||||
# Support carrier URLs that prefix all other URLs, such as /telefonica/.
|
||||
# NOTE: To set this to False, you need to do so in this file or copy over
|
||||
# the conditional middleware removal below.
|
||||
|
@ -92,14 +88,6 @@ INSTALLED_APPS += (
|
|||
'mkt.webapps',
|
||||
)
|
||||
|
||||
if not REGION_STORES:
|
||||
SUPPORTED_NONLOCALES += (
|
||||
'manifest.webapp',
|
||||
'mozmarket.js',
|
||||
'appcache',
|
||||
'csrf',
|
||||
)
|
||||
|
||||
# TODO: I want to get rid of these eventually but it breaks some junk now.
|
||||
# MIDDLEWARE_CLASSES.remove('mobility.middleware.DetectMobileMiddleware')
|
||||
# MIDDLEWARE_CLASSES.remove('mobility.middleware.XMobileMiddleware')
|
||||
|
@ -114,14 +102,12 @@ if USE_CARRIER_URLS:
|
|||
|
||||
MIDDLEWARE_CLASSES.append('mkt.site.middleware.RequestCookiesMiddleware')
|
||||
|
||||
if REGION_STORES:
|
||||
MIDDLEWARE_CLASSES.remove('amo.middleware.LocaleAndAppURLMiddleware')
|
||||
MIDDLEWARE_CLASSES += [
|
||||
'mkt.site.middleware.RedirectPrefixedURIMiddleware',
|
||||
'mkt.site.middleware.LocaleMiddleware',
|
||||
'mkt.site.middleware.RegionMiddleware',
|
||||
]
|
||||
MIDDLEWARE_CLASSES.remove('amo.middleware.LocaleAndAppURLMiddleware')
|
||||
MIDDLEWARE_CLASSES += [
|
||||
'mkt.site.middleware.RedirectPrefixedURIMiddleware',
|
||||
'mkt.site.middleware.LocaleMiddleware',
|
||||
'mkt.site.middleware.RegionMiddleware',
|
||||
|
||||
'mkt.fragments.middleware.VaryOnAJAXMiddleware',
|
||||
'mkt.site.middleware.DeviceDetectionMiddleware',
|
||||
'mkt.fragments.middleware.HijackRedirectMiddleware',
|
||||
|
@ -137,8 +123,7 @@ MIDDLEWARE_CLASSES += [
|
|||
TEMPLATE_DIRS += (path('mkt/templates'), path('mkt/zadmin/templates'))
|
||||
TEMPLATE_CONTEXT_PROCESSORS = list(TEMPLATE_CONTEXT_PROCESSORS)
|
||||
TEMPLATE_CONTEXT_PROCESSORS.remove('amo.context_processors.global_settings')
|
||||
if REGION_STORES:
|
||||
TEMPLATE_CONTEXT_PROCESSORS.remove('amo.context_processors.app')
|
||||
TEMPLATE_CONTEXT_PROCESSORS.remove('amo.context_processors.app')
|
||||
TEMPLATE_CONTEXT_PROCESSORS += [
|
||||
'mkt.site.context_processors.global_settings',
|
||||
]
|
||||
|
|
|
@ -15,20 +15,11 @@ from amo.urlresolvers import reverse
|
|||
import mkt
|
||||
from mkt.site.middleware import DeviceDetectionMiddleware
|
||||
|
||||
|
||||
class MiddlewareCase(amo.tests.TestCase):
|
||||
"""Temporary until new lang+region detection gets QA'd."""
|
||||
|
||||
def setUp(self):
|
||||
if not settings.REGION_STORES:
|
||||
raise SkipTest
|
||||
|
||||
|
||||
_langs = ['de', 'en-US', 'es', 'fr', 'pt-BR', 'pt-PT']
|
||||
|
||||
|
||||
@mock.patch.object(settings, 'LANGUAGES', [x.lower() for x in _langs])
|
||||
class TestRedirectPrefixedURIMiddleware(MiddlewareCase):
|
||||
class TestRedirectPrefixedURIMiddleware(amo.tests.TestCase):
|
||||
|
||||
def test_redirect_for_good_application(self):
|
||||
for app in amo.APPS:
|
||||
|
@ -107,7 +98,7 @@ class TestRedirectPrefixedURIMiddleware(MiddlewareCase):
|
|||
@mock.patch.object(settings, 'LANGUAGES', [x.lower() for x in _langs])
|
||||
@mock.patch.object(settings, 'LANGUAGE_URL_MAP',
|
||||
dict([x.lower(), x] for x in _langs))
|
||||
class TestLocaleMiddleware(MiddlewareCase):
|
||||
class TestLocaleMiddleware(amo.tests.TestCase):
|
||||
|
||||
def test_accept_good_locale(self):
|
||||
locales = [
|
||||
|
@ -248,7 +239,7 @@ class TestLocaleMiddleware(MiddlewareCase):
|
|||
|
||||
@mock.patch.object(settings, 'LANGUAGE_URL_MAP',
|
||||
dict([x.lower(), x] for x in _langs))
|
||||
class TestRegionMiddleware(MiddlewareCase):
|
||||
class TestRegionMiddleware(amo.tests.TestCase):
|
||||
|
||||
def test_lang_set_with_region(self):
|
||||
for region in ('worldwide', 'us', 'br'):
|
||||
|
@ -379,7 +370,7 @@ class TestRegionMiddleware(MiddlewareCase):
|
|||
eq_(r.cookies['region'].value, 'us')
|
||||
|
||||
|
||||
class TestVaryMiddleware(MiddlewareCase):
|
||||
class TestVaryMiddleware(amo.tests.TestCase):
|
||||
|
||||
def test_no_vary_cookie(self):
|
||||
# What is expected to `Vary`.
|
||||
|
@ -513,7 +504,5 @@ class TestLoginRequiredMiddleware(amo.tests.TestCase):
|
|||
])
|
||||
)
|
||||
def test_proper_redirects_with_region_stores(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
|
||||
r = self.client.get('/')
|
||||
self.assert3xx(r, reverse('users.login'))
|
||||
|
|
|
@ -110,12 +110,10 @@ class TestWebapp(amo.tests.TestCase):
|
|||
eq_(w.app_slug, 'slug~')
|
||||
|
||||
def test_get_url_path(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
webapp = Webapp(app_slug='woo')
|
||||
eq_(webapp.get_url_path(), '/app/woo/')
|
||||
|
||||
def test_get_stats_url(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
webapp = Webapp(app_slug='woo')
|
||||
|
||||
eq_(webapp.get_stats_url(), '/app/woo/statistics/')
|
||||
|
@ -126,7 +124,6 @@ class TestWebapp(amo.tests.TestCase):
|
|||
eq_(url, '/app/woo/statistics/installs-day-20120101-20120201.json')
|
||||
|
||||
def test_get_inapp_stats_url(self):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
webapp = Webapp.objects.create(app_slug='woo')
|
||||
eq_(webapp.get_stats_inapp_url(action='revenue', inapp='duh'),
|
||||
'/app/woo/statistics/inapp/duh/sales/')
|
||||
|
@ -645,8 +642,6 @@ class TestIsVisible(amo.tests.WebappTestCase):
|
|||
def setUp(self):
|
||||
super(TestIsVisible, self).setUp()
|
||||
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
|
||||
self.regular = UserProfile.objects.get(username='regularuser')
|
||||
self.partner = UserProfile.objects.get(username='partner')
|
||||
self.dev = self.app.authors.all()[0]
|
||||
|
@ -870,10 +865,6 @@ class TestIsVisible(amo.tests.WebappTestCase):
|
|||
|
||||
class TestListedIn(amo.tests.WebappTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestListedIn, self).setUp()
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
|
||||
def test_nowhere(self):
|
||||
eq_(self.app.listed_in(), False)
|
||||
|
||||
|
@ -921,10 +912,6 @@ class TestListedIn(amo.tests.WebappTestCase):
|
|||
|
||||
class TestContentRatingsIn(amo.tests.WebappTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestContentRatingsIn, self).setUp()
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
|
||||
def test_not_in_region(self):
|
||||
for region in mkt.regions.ALL_REGIONS:
|
||||
eq_(self.app.content_ratings_in(region=region), [])
|
||||
|
|
|
@ -220,7 +220,6 @@ class TestUpdateManifest(amo.tests.TestCase):
|
|||
@mock.patch.object(settings, 'SITE_URL', 'http://test')
|
||||
@mock.patch('mkt.webapps.tasks._open_manifest')
|
||||
def test_validation_error_logs(self, open_manifest):
|
||||
self.skip_if_disabled(settings.REGION_STORES)
|
||||
# Mock original manifest file lookup.
|
||||
open_manifest.return_value = original
|
||||
# Mock new manifest with name change.
|
||||
|
|
Загрузка…
Ссылка в новой задаче