Permalink
Browse files

add name in json point

  • Loading branch information...
1 parent b9bbc72 commit bab26ad7bd129379a56eb8bd8b98aeeaeca2a5e5 @andrewsmedina andrewsmedina committed Aug 15, 2010
Showing with 8 additions and 2 deletions.
  1. +3 −1 wifimap/spots/tests/test_json_point.py
  2. +5 −1 wifimap/spots/views.py
@@ -1,5 +1,6 @@
from django.test import TestCase
from django.core.urlresolvers import reverse
+from django.utils import simplejson
from spots.models import AccessPoint
@@ -19,4 +20,5 @@ def test_view_exists(self):
def test_view_returns_json(self):
assert self.response.items()[0][1] == 'application/json'
-
+ def test_name_in_json(self):
+ assert 'point 1' in simplejson.loads(self.response.content)['name']
View
@@ -76,4 +76,8 @@ def spot(request, id):
def spot_json(request, id):
access_point = get_object_or_404(AccessPoint, id=id)
- return HttpResponse('', mimetype="application/json")
+
+ json = {
+ 'name': access_point.name,
+ }
+ return HttpResponse(simplejson.dumps(json), mimetype="application/json")

0 comments on commit bab26ad

Please sign in to comment.