To test REST APIs, perform the following steps:
- Create a tests.py file in your bulletin_board app, with just the setup and teardown methods, as follows:
# bulletin_board/tests.py from django.contrib.auth.models import Userfrom django.core.urlresolvers import reversefrom rest_framework import statusfrom rest_framework.test import APITestCasefrom .models import Category, Bulletinclass BulletinTests(APITestCase): @classmethod def setUpClass(cls): super(BulletinTests, cls).setUpClass() cls.superuser = User.objects.create_superuser( username="test-admin", password="test-admin", email="") cls.category = Category.objects.create(title="Movies") cls.bulletin = Bulletin.objects.create( bulletin_type="searching", category=cls.category, ...