I have developed an application using the search form from chapter 7 of the Django Book, http://www.djangobook.com/en/1.0/chapter07/. I am having trouble testing the search view, it seems like (from my view below) it is not returning 'q', but rather, returning nothing. It might be the way I have written my test function but I'm not sure where I am going wrong.
This is my test function: """ def test_get_keyword_search_aevnam1a(self): #posting a keyword search for 'aevnam1a' kw='aevnam1a' get_data = {'query': kw} response = self.client.get('/lib/project/7/checksearch/', get_data) #checking that the search prodced results self.assertEqual(response.status_code, 200) self.assertEqual(response.template[0].name, 'allsearch.html') self.failUnless('Results for keyword search: aevnam1a' in response.content) """ This is my view: """ def checksearch(request, project_id): .... .... query = request.GET.get('q', '') if query: qset = ( Q(variable__icontains=query) | Q(checkname__icontains=query) | Q(errmsg__icontains=query) ) results = Checks.objects.filter(qset).distinct() else: results = [] return render_to_response("allsearch.html", { 'results': results, 'query': query, }) """ Thank you in advance for any help. Tony --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---