Write and Run the Tests for the URLs

Learn to write and run the tests for the URLs.

In this lesson, we continue to build the e-library application by adding tests for our Django application URLs.

What are URLs?

The root of a website is usually mapped to a given domain name, which is mapped to an IP address. For example, www.educative.io is the main URL that navigates us to the root of the website (the home page). However, we can have several other URLs like the following:

These can be referred to as application level URLs. Inside this application, we can then have URLs for each view function or template, like so:

URLs are very important to an application and should be tested as well.

The complete test for our URLs

Here’s the complete code that shows how we test the URLs for the e-library application:

Get hands-on with 1400+ tech skills courses.