I am new to tests and the tutorials are not helping me at all (they are either old or not appliable to my case).
I want to test some functionalities on Django. Let's say I want to test this:
class PageDetailView(AuthorizedView, PermissionRequiredMixin, DetailView):
"""
Page Detail View
This view will load the whole dataset for a Page
"""
permission_required = 'view_page'
# This is temporary. The idea is to redirect user to a call_to_action page
redirect_field_name = 'panel'
model = Page
template_name = 'twist/entity_topic_detail.html'
def get_context_data(self, **kwargs):
context = super(PageDetailView, self).get_context_data(**kwargs)
evaluated_news = EvaluatedNews(self.object,
self.request.user)
context['evaluated_news'] = evaluated_news()
context['modules'] = [
'sources',
'ranking',
'topics',
'locations_coord',
'terms',
'news',
'relations',
'twitterterms',
'twittertweets',
'twitterheatmap'
]
return context
How can I apply a test?
This is how the url is set:
url(r'detail/(?P<pk>[\d]+)/$', views.PageDetailView.as_view(), name='detail'),
Aucun commentaire:
Enregistrer un commentaire