gt;>>>
>>>>>>>
>>>>>>> On Fri, Oct 16, 2020 at 11:10 AM Akinfolarin Stephen <
>>>>>>> akinfolar...@gmail.com> wrote:
>>>>>>>
>>>>>>>> First I will like you to tell me
2020, 06:27 Salima Begum <
>>>>>>> sali...@rohteksolutions.com> wrote:
>>>>>>>
>>>>>>>> Hi all,
>>>>>>>>
>>>>>>>> I have written test case for views for details page. Here is
gt;
>>>>>>> ```
>>>>>>> from django.test import RequestFactory
>>>>>>> from django.urls import reverse
>>>>>>> from django.contrib.auth.models import User
>>>>>>> from pages.models import vk_custo
gt;>> import pytest
>>>>>>
>>>>>> from pages.views import ProductDetails
>>>>>>
>>>>>>
>>>>>> @pytest.mark.django_db
>>>>>> class TestViews:
>>>>>>
>>>>>> def te
;>> path = reverse('detail', kwargs={'pk': 1516})
>>>>> request = RequestFactory().get(path)
>>>>> request.user = mixer.blend(vk_customer)
>>>>>
>>>>> response = ProductDetails(request,
roductDetails(request, pk=1516)
>>>> print(response)
>>>> assert response.status_code == 200
>>>> ```
>>>> *This the error i am getting.*
>>>> ________ ERROR
>>&
ProductDetails(request, pk=1516)
>>>> print(response)
>>>> assert response.status_code == 200
>>>> ```
>>>> *This the error i am getting.*
>>>> ____________ ERROR
>>>&
st module
>>> 'H:\vikreya\mysite\pages\tests\test_views.py'.
>>> Hint: make sure your test modules/packages have valid Python names.
>>> Traceback:
>>> c:\users\user\appdata\local\programs\python\python38\lib\importlib\__init__.py:127:
>>> in import_modul
t; ImportError while importing test module
>>> 'H:\vikreya\mysite\pages\tests\test_views.py'.
>>> Hint: make sure your test modules/packages have valid Python names.
>>> Traceback:
>>> c:\users\user\appdata\local\programs\python\python38\lib\importlib\__init__.py:
__
>> ImportError while importing test module
>> 'H:\vikreya\mysite\pages\tests\test_views.py'.
>> Hint: make sure your test modules/packages have valid Python names.
>> Traceback:
>> c:\users\user\appdata\lo
programs\python\python38\lib\importlib\__init__.py:127:
> in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
> pages\tests\test_views.py:8: in
> from pages.views import ProductDetails
> E ImportError: cannot import name 'ProductDetails
ython\python38\lib\importlib\__init__.py:127:
in import_module
return _bootstrap._gcd_import(name[level:], package, level)
pages\tests\test_views.py:8: in
from pages.views import ProductDetails
E ImportError: cannot import name 'ProductDetails' from 'pages.views'
(H:
12 matches
Mail list logo