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 <yveyeh@gmail.com> wrote:
Hello,--
I wish to know how I can call a method that takes in a request as one of its parameters such asdef 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 django-users+unsubscribe@googlegroups.com .
To post to this group, send email to django-users@googlegroups.com.
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
For more options, visit https://groups.google.com/d/optout .
--
Julio Biason, Sofware Engineer
AZION | Deliver. Accelerate. Protect.
Office: +55 51 3083 8101 | Mobile: +55 51 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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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.
No comments:
Post a Comment