'how to write unit test using pytest for django url

my url and function are as follows

url

path('drivers/', views.drivers, name='drivers'),

views.py

@login_required(login_url='/account/login')
def drivers(request):
    drivers = Drivers.object.all()
    return render(request, "drivers.html", {'drivers': drivers})

I've just started learning unit testing.

How do i write unit test to check my url is working as expected.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source