xxxxxxxxxx
from rest_framework.test import APIClient
# Instantiate the APIClient
client = APIClient()
# Send a GET request to the /books/ endpoint
response = client.get('/books/')
# Send a POST request with data
response = client.post('/books/', {'title': 'New Book', 'author': 'John Doe'})
# Check response status and data
assert response.status_code == 200
assert 'New Book' in response.data['title']