Skip to content

Commit

Permalink
remove collections-use-es-for-apps waffle switch
Browse files Browse the repository at this point in the history
  • Loading branch information
cvan committed Jan 27, 2014
1 parent 7f6ffda commit 73e3c3d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
@@ -0,0 +1 @@
DELETE FROM waffle_switch_mkt WHERE name = 'collections-use-es-for-apps';
4 changes: 1 addition & 3 deletions mkt/collections/serializers.py
Expand Up @@ -2,7 +2,6 @@
import os
import uuid

import waffle
from rest_framework import serializers
from rest_framework.fields import get_component
from rest_framework.reverse import reverse
Expand Down Expand Up @@ -78,8 +77,7 @@ def field_to_native(self, obj, field_name):
# have a view in the context and that the waffle flag is active. If
# everything checks out, bypass the db and use ES to fetch apps for a
# nice performance boost.
if (self.context.get('use-es-for-apps') and self.context.get('view')
and waffle.switch_is_active('collections-use-es-for-apps')):
if self.context.get('use-es-for-apps') and self.context.get('view'):
return self.field_to_native_es(obj, request)

qs = get_component(obj, self.source)
Expand Down
15 changes: 9 additions & 6 deletions mkt/collections/tests/test_serializers.py
Expand Up @@ -124,23 +124,26 @@ class TestCollectionMembershipField(BaseTestCollectionMembershipField,
class TestCollectionMembershipFieldES(BaseTestCollectionMembershipField,
CollectionDataMixin,
amo.tests.ESTestCase):
""" Same tests as TestCollectionMembershipField above, but we need a
different setUp and more importantly, we need to force a sync refresh
in ES when we modify our app """
"""
Same tests as TestCollectionMembershipField above, but we need a
different setUp and more importantly, we need to force a sync refresh
in ES when we modify our app.
"""

fixtures = fixture('user_2519')

def setUp(self):
self.create_switch('collections-use-es-for-apps')
super(TestCollectionMembershipFieldES, self).setUp()
self.field.context['view'] = FeaturedSearchView()
self.user = UserProfile.objects.get(pk=2519)
AddonUser.objects.create(addon=self.app, user=self.user)
self.refresh('webapp')

def _field_to_native_profile(self, profile='0.0'):
""" Like _field_to_native_profile in BaseTestCollectionMembershipField,
but calling field_to_native_es directly. """
"""
Like _field_to_native_profile in BaseTestCollectionMembershipField,
but calling field_to_native_es directly.
"""
request = self.get_request({'pro': profile, 'dev': 'firefoxos'})
self.field.context['request'] = request
return self.field.field_to_native_es(self.collection, request)
Expand Down
1 change: 0 additions & 1 deletion mkt/search/tests/test_api.py
Expand Up @@ -736,7 +736,6 @@ def setUp(self):
name='Hi', description='Mom', collection_type=self.col_type,
category=self.cat, is_public=True, region=mkt.regions.US.id)
self.qs['region'] = mkt.regions.US.slug
self.create_switch('collections-use-es-for-apps')
# FIXME: mock the search part, we don't care about it.

def make_request(self):
Expand Down

0 comments on commit 73e3c3d

Please sign in to comment.