Running unit tests again with pytest

Now, go to the restful01 folder that contains the manage.py file, with the virtual environment activated, and run the following command to execute pytest again with the -v option to increase verbosity:

pytest -v

In this case, pytest will run all the methods whose name starts with the test_ prefix in both the DroneCategoryTests and PilotTests classes and display the results.

The following screenshot shows a sample output generated for the new execution of the pytest command with the increased verbosity:

We enabled verbose mode again, and therefore, the output displayed the full test names that the test_post_and_get_pilot and test_try_to_post_pilot_without_token test methods passed.

We should continue writing tests related to pilots, drone categories, drones, and competitions. It is extremely important that we cover all the scenarios for our RESTful Web Service. Automated tests will make it possible for us to make sure that each new version of our RESTful Web Service will work as expected after it is deployed to production.

We built RESTful Web Services with Django, the Django REST framework, and Python 3.6. We learned to design a RESTful Web Service from scratch, starting with the requirements, and to run some of the necessary tests to make sure our web service runs as expected. We learned to work with different command-line and GUI tools to make our development tests easy. We understood many features included in the Django REST framework and how to configure them.

Now, we are ready to create RESTful Web Services with Django and the Django REST framework. We will definitely need to dive deep into additional features, packages, and configurations. We definitely have a great baseline to develop our next RESTful Web Service with the most versatile programming language: Python.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.56.29