O'Reilly logo

Web Development with Django Cookbook - Second Edition by Aidas Bendoraitis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing API created using Django REST framework

We already have an understanding about how to write operational acceptance and unit tests. In this recipe, we will go through component interface testing for the REST API that we created earlier in this book.

Tip

If you are not familiar with what REST API is and how to use it, you can learn about it at http://www.restapitutorial.com/.

Getting ready

Let's start with the bulletin_board app from the Using Django REST framework to create API recipe in Chapter 9, Data Import and Export.

How to do it...

To test REST API, perform the following steps:

  1. Create a tests.py file in your bulletin_board app, as follows:
    # bulletin_board/tests.py # -*- coding: UTF-8 -*- from __future__ import unicode_literals from django.contrib.auth.models ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required