Skip to content

Commit

Permalink
Merge pull request #2127 from AdrianGaudebert/1013321-fix-supersearch…
Browse files Browse the repository at this point in the history
…-field-update

Fixes bug 1013321 - Fixed problem with turning supersearch fields values...
  • Loading branch information
adngdb committed Jun 17, 2014
2 parents 266be5b + a6e34bf commit 0afae91
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
9 changes: 7 additions & 2 deletions webapp-django/crashstats/manage/tests/test_views.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1042,8 +1042,12 @@ def mocked_get(url, **options):


def mocked_put(url, data, **options): def mocked_put(url, data, **options):
assert '/supersearch/field/' in url assert '/supersearch/field/' in url
assert 'name' in data
assert 'description' in data ok_('name' in data)
ok_('description' in data)
ok_('is_returned' in data)

ok_(not data['is_returned'])


return Response(True) return Response(True)


Expand All @@ -1056,6 +1060,7 @@ def mocked_put(url, data, **options):
'name': 'something', 'name': 'something',
'in_database_name': 'something', 'in_database_name': 'something',
'description': 'hello world', 'description': 'hello world',
'is_returned': False,
} }
) )
eq_(response.status_code, 302) eq_(response.status_code, 302)
Expand Down
4 changes: 2 additions & 2 deletions webapp-django/crashstats/manage/views.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def supersearch_field_create(request):
return http.HttpResponseBadRequest(field_data) return http.HttpResponseBadRequest(field_data)


api = SuperSearchField() api = SuperSearchField()
api.post(**field_data) api.post(field_data)


# Refresh the cache for the fields service. # Refresh the cache for the fields service.
SuperSearchFields().get(refresh_cache=True) SuperSearchFields().get(refresh_cache=True)
Expand All @@ -469,7 +469,7 @@ def supersearch_field_update(request):
return http.HttpResponseBadRequest(field_data) return http.HttpResponseBadRequest(field_data)


api = SuperSearchField() api = SuperSearchField()
api.put(**field_data) api.put(field_data)


# Refresh the cache for the fields service. # Refresh the cache for the fields service.
SuperSearchFields().get(refresh_cache=True) SuperSearchFields().get(refresh_cache=True)
Expand Down
10 changes: 4 additions & 6 deletions webapp-django/crashstats/supersearch/models.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -204,13 +204,11 @@ class SuperSearchField(models.SocorroMiddleware):
def get(self, **kwargs): def get(self, **kwargs):
raise NotImplemented() raise NotImplemented()


def post(self, **kwargs): def post(self, payload):
params = self.kwargs_to_params(kwargs) return super(SuperSearchField, self).post(self.URL_PREFIX, payload)
return super(SuperSearchField, self).post(self.URL_PREFIX, params)


def put(self, **kwargs): def put(self, payload):
params = self.kwargs_to_params(kwargs) return super(SuperSearchField, self).put(self.URL_PREFIX, payload)
return super(SuperSearchField, self).put(self.URL_PREFIX, params)




class Query(models.SocorroMiddleware): class Query(models.SocorroMiddleware):
Expand Down

0 comments on commit 0afae91

Please sign in to comment.