Skip to content

Commit

Permalink
returns template with all spots in search ajax
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsmedina committed Aug 14, 2010
1 parent a688cca commit 3b4d388
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 9 additions & 8 deletions wifimap/spots/tests/test_search.py
Expand Up @@ -3,12 +3,14 @@
from django.utils import simplejson

from spots.models import AccessPoint
from spots.views import list_spots

class SearchViewTest(TestCase):

def setUp(self):
self.url = reverse('spots_search')
self.add_some_points()
self.access_points = AccessPoint.objects.all()

def tearDown(self):
AccessPoint.objects.all().delete()
Expand Down Expand Up @@ -46,11 +48,10 @@ def test_search_returns_expected_point(self):

assert expected['center_point'] == simplejson.loads(response.content)['center_point']

# def test_search_returns_template_with_neighbors_points(self):
# response = self.client.get(self.url, {'place':'Rio de Janeiro, Brazil'})
#
# expected = {
# 'center_point': ["Rio de Janeiro - RJ, Brazil", [-22.903539299999998, -43.209586899999998]]
# }
#
# assert expected[''] == simplejson.loads(response.content)['center_point']
def test_search_returns_template_with_access_point_list(self):
response = self.client.get(self.url, {'place':'Rio de Janeiro, Brazil'})


template = list_spots(self.access_points)

assert template == simplejson.loads(response.content)['template']
2 changes: 2 additions & 0 deletions wifimap/spots/views.py
Expand Up @@ -52,6 +52,8 @@ def search_spots(request):
address,
[lat, lng]
]

json['template'] = list_spots(points)

for point in points:
json['points'].append(
Expand Down

0 comments on commit 3b4d388

Please sign in to comment.