Hi Yufenyuy, You just instantiate the object and call the function. Something like
created_object = MyModel(field='some_value') view = MyView() view.get(request, created_object.pk) If you want to create a request object, you can use RequestFactory: https://docs.djangoproject.com/en/2.0/topics/testing/advanced/#the-request-factory On Fri, Jun 1, 2018 at 8:02 AM, Yufenyuy Veyeh Didier <[email protected]> wrote: > Hello, > I wish to know how I can call a method that takes in a request as one of > its parameters such as > > def get(self, request, pk): > > #I am writing a test method to test the above method too. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/django-users/8740fe0d-e6b3-4caf-b35e-a442ee05e209%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/8740fe0d-e6b3-4caf-b35e-a442ee05e209%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- *Julio Biason*, Sofware Engineer *AZION* | Deliver. Accelerate. Protect. Office: +55 51 3083 8101 <callto:+555130838101> | Mobile: +55 51 <callto:+5551996209291>*99907 0554* -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEM7gE3bFhJ5runouLCWMZw%2BkR13d3Bu9h42i849NuOLvE1eAQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

