python - Django assertTemplateUsed() throws exception with Jinja templates -


when try run test:

from django.test import testcase django.core.urlresolvers import reverse django.test import client  class statistictest(testcase):     def setup(self):         self.client = client()      def test_schedule_view(self):         url = reverse('schedule')         response = self.client.get(url)         self.assertequal(response.status_code, 200)         self.asserttemplateused(response, 'schedule.html') 

i assertionerror: no templates used render response.

it's view:

class schedule(view):     def get(self, request):         games = add_team_info(query.get_current_schedule())         if games not []:              available_schedules = generate_schedule_list(games[0]["season_type"], games[0]["week"])              is_available = true         else:              available_schedules = []              is_available = false         return render_to_response("schedule.html",                                {"games": games, "available_schedules": available_schedules, "is_available": is_available}) 

and urls.py:

url(r'^schedule/$', views.schedule.as_view(), name='schedule'), 

your problem asserttemplateused works django templates, not jinja templates.

there's open ticket 24622 issue.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -