Transaction errors on test_search_with_sql_injection

RESOLVED FIXED

Status

RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: peterbe, Assigned: peterbe)

Tracking

Trunk
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Description

4 years ago
======================================================================
ERROR: test_search_with_sql_injection (test_views.TestSearch)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/peterbe/dev/MOZILLA/AIRMOZILLA/airmozilla/airmozilla/search/tests/test_views.py", line 380, in test_search_with_sql_injection
    response = self.client.get(url, {'q': q})
  File "/Users/peterbe/virtualenvs/airmozilla/lib/python2.6/site-packages/django/test/client.py", line 473, in get
    response = super(Client, self).get(path, data=data, **extra)
  File "/Users/peterbe/virtualenvs/airmozilla/lib/python2.6/site-packages/django/test/client.py", line 280, in get
    return self.request(**r)
  File "/Users/peterbe/virtualenvs/airmozilla/lib/python2.6/site-packages/django/test/client.py", line 426, in request
    response = self.handler(environ)
  File "/Users/peterbe/virtualenvs/airmozilla/lib/python2.6/site-packages/django/test/client.py", line 109, in __call__
    response = self.get_response(request)
  File "/Users/peterbe/virtualenvs/airmozilla/lib/python2.6/site-packages/django/core/handlers/base.py", line 194, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/Users/peterbe/virtualenvs/airmozilla/lib/python2.6/site-packages/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/peterbe/dev/MOZILLA/AIRMOZILLA/airmozilla/airmozilla/search/views.py", line 216, in home
    return render(request, 'search/home.html', context)
  File "/Users/peterbe/virtualenvs/airmozilla/lib/python2.6/site-packages/django/shortcuts/__init__.py", line 49, in render
    context_instance = RequestContext(request, current_app=current_app)
  File "/Users/peterbe/virtualenvs/airmozilla/lib/python2.6/site-packages/django/template/context.py", line 169, in __init__
    self.update(processor(request))
  File "/Users/peterbe/dev/MOZILLA/AIRMOZILLA/airmozilla/airmozilla/main/context_processors.py", line 51, in sidebar
    _channel = channels[0]
  File "/Users/peterbe/virtualenvs/airmozilla/lib/python2.6/site-packages/django/db/models/query.py", line 115, in __getitem__
    return self._result_cache[k]
IndexError: list index out of range
(Assignee)

Comment 1

4 years ago
Leonard, 
I finally got around to this error. It's related to how transaction handling has changed in Django 1.6 and I guess I never noticed because when you start with a clean database you don't notice it. 

I now have it re-producible locally.
Assignee: nobody → peterbe
Status: NEW → ASSIGNED

Comment 3

4 years ago
Commits pushed to master at https://github.com/mozilla/airmozilla

https://github.com/mozilla/airmozilla/commit/b2fe0c59b3f26340506bfd1ceb3a7ce6654831ef
fixes bug 1139172 - Transaction errors on test_search_with_sql_injection

https://github.com/mozilla/airmozilla/commit/56202c10e9a48f0484a019f0a5cf0cd7aa6e708e
Merge pull request #216 from peterbe/bug-1139172-transaction-errors-on-test_search_with_sql_injection

fixes bug 1139172 - Transaction errors on test_search_with_sql_injection
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.