Skip to content

Commit

Permalink
add name in json point
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsmedina committed Aug 15, 2010
1 parent b9bbc72 commit bab26ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion wifimap/spots/tests/test_json_point.py
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.test import TestCase from django.test import TestCase
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils import simplejson


from spots.models import AccessPoint from spots.models import AccessPoint


Expand All @@ -19,4 +20,5 @@ def test_view_exists(self):
def test_view_returns_json(self): def test_view_returns_json(self):
assert self.response.items()[0][1] == 'application/json' assert self.response.items()[0][1] == 'application/json'



def test_name_in_json(self):
assert 'point 1' in simplejson.loads(self.response.content)['name']
6 changes: 5 additions & 1 deletion wifimap/spots/views.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -76,4 +76,8 @@ def spot(request, id):


def spot_json(request, id): def spot_json(request, id):
access_point = get_object_or_404(AccessPoint, id=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.