I have written a unit test to test an api....Its a GET call....
When I run it , i get this error ...Heres the traceback....

```
Traceback (most recent call last):
  File "/home/arindam31/XXX-Name/mapi/tests.py", line 141, in test_get_cities
    response = self.cl.get('/mapi/latest/cities/')
  File "/usr/local/lib/python2.7/dist-packages/django/test/client.py", line 445, in get
    response = super(Client, self).get(path, data=data, **extra)
  File "/usr/local/lib/python2.7/dist-packages/django/test/client.py", line 229, in get
    return self.request(**r)
  File "/usr/local/lib/python2.7/dist-packages/django/test/client.py", line 387, in request
    response = self.handler(environ)
  File "/usr/local/lib/python2.7/dist-packages/django/test/client.py", line 84, in __call__
    response = self.get_response(request)
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 169, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 218, in handle_uncaught_exception
    return callback(request, **param_dict)
  File "/home/arindam31/XXX-Name/saul/views.py", line 546, in do_handle_500
    return render_to_response("500.html", context_instance=RequestContext(request))
  File "/usr/local/lib/python2.7/dist-packages/django/template/context.py", line 177, in __init__
    self.update(processor(request))
  File "/home/arindam31/XXX-Name/saul/context_processors.py", line 46, in common_context
    ret_dict['city'] = request.city
AttributeError: 'WSGIRequest' object has no attribute 'city'

```

Heres my unit test...

```
def test_get_cities(self):
    request = HttpRequest()
    request.city = self.c1
    response = self.cl.get('/mapi/latest/cities/')
    content = response.content
    data = json.loads(content)
    for city in City.objects.all():
        assert city.name in data
        assert data[city.name] == city.pk

```

Here , self.c1 is a city type object in the setUp part....HttpRequest is from django.http.

The view being tested is below:

```
def get_cities(request): 
    print "1"
    if ENABLE_HTTPS_CHECK and not request.is_secure():
        return HttpResponseForbidden()
    if request.method != 'GET':
        return HttpResponseNotAllowed('Not allowed')
    city_map = _get_city_map()
    response = HttpResponse(json.dumps(city_map)
    content_type='application/json')
    response['Cache-Control'] = 'no-cache'
    return response

```