Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add name in json point

  • Loading branch information...
commit bab26ad7bd129379a56eb8bd8b98aeeaeca2a5e5 1 parent b9bbc72
@andrewsmedina andrewsmedina authored
View
4 wifimap/spots/tests/test_json_point.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
6 wifimap/spots/views.py
@@ -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")
Please sign in to comment.
Something went wrong with that request. Please try again.