def hit_the_api(self): path = reverse("audio-list", kwargs={"version": "v3"}) request = RequestFactory().get(path) # Create the view and change the milestones to be something we can test # (Otherwise, we need to make 1,000 requests in this test) view = AudioViewSet.as_view({"get": "list"}) view.milestones = [1] # Set the attributes needed in the absence of middleware request.user = self.user request.resolver_match = ResolverMatch(view, {"version": "v3"}, "audio-list") view(request)
def hit_the_api(self): path = reverse('audio-list', kwargs={'version': 'v3'}) request = RequestFactory().get(path) # Create the view and change the milestones to be something we can test # (Otherwise, we need to make 1,000 requests in this test) view = AudioViewSet.as_view({'get': 'list'}) view.milestones = [1] # Set the attributes needed in the absence of middleware request.user = self.user request.resolver_match = ResolverMatch( view, {'version': 'v3'}, 'audio-list', ) view(request)