Hi RyuCoder

Should not get_object_or_404 shortcut retry 404 status code?

El lunes, 10 de junio de 2019, 15:29:24 (UTC-5), RyuCoder escribió:
>
> Whats your question?
> I failed to understand that 😅
>
> On Tue, Jun 11, 2019, 1:45 AM Cristhiam Gabriel Fernández <
> cristh...@gmail.com <javascript:>> wrote:
>
>> Hi Django super heroes
>>
>> I'm making of test cases for my simple Django application. When I test a 
>> view with get_object_or_404 shortcut it returns 200 status code.
>>
>> def my_view(self, request):
>>   obj_id = request.POST.get('id')
>>   obj = get_object_or_404(MyModel, pk=id)
>>   ....
>>
>>
>> # Test case
>> ...data = {'id': 999}
>>  response = self.client.post(reverse('view.name'), data=data)
>>  self.assertEqual(response.status_code, 404)
>>
>>
>> I'm getting *AssertionError: 200 != 404*
>>
>> -- 
>> 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...@googlegroups.com <javascript:>.
>> To post to this group, send email to django...@googlegroups.com 
>> <javascript:>.
>> 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/488aa077-1b11-4404-8d4e-0dad1885707b%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/488aa077-1b11-4404-8d4e-0dad1885707b%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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+unsubscr...@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/c6605bef-45e0-431f-8861-f4b3e38f8856%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to