Is Your API Working? Simple Testing Strategies for DRF Beginners

Neon-green pathways on a dark grey grid visualize Python API functionality, showcasing successful testing & database integration

Welcome to MasterPythonNow, your gateway to Python mastery!

Are you ready to build robust and reliable web applications? Dive into our comprehensive guide to API testing strategies for Python, specifically tailored for beginners using the Django REST Framework (DRF). Uncover the secrets to ensuring your APIs function flawlessly, preventing costly errors and delivering seamless user experiences. Don't just build; build with confidence. Read on to discover practical techniques you can implement today!

Table

Introduction to API Testing with Django REST Framework

Why API Testing Matters for Your DRF Projects

In the realm of web development with Python and Django REST Framework (DRF), ensuring your APIs function as expected is paramount. API testing is not just a best practice; it's a necessity for building robust and reliable applications. Imagine an e-commerce platform where the API responsible for processing payments fails intermittently.

This could lead to lost sales, frustrated customers, and damage to the business's reputation. API testing acts as a safety net, catching potential issues before they impact your users. By systematically testing your APIs, you can identify bugs early in the development cycle, reducing the cost and effort of fixing them later when they are deeply integrated into the system.

Moreover, well-tested APIs contribute significantly to the maintainability and scalability of your projects. As your application grows and evolves, you'll inevitably make changes to your API endpoints. Without comprehensive API tests, introducing new features or refactoring existing code becomes a risky endeavor. Tests act as living documentation, verifying that changes haven't broken existing functionality.

They provide confidence to developers making modifications, ensuring that the API continues to function correctly after each update. Consider a social media application; frequent updates are common. API tests ensure that user profiles, post creation, and feed retrieval APIs remain stable and reliable even with continuous deployments and feature additions. In essence, robust API testing strategies are the cornerstone of building dependable and scalable DRF applications.

Targeting Beginners: Demystifying API Testing in Python

For those new to Django REST Framework and API development, the concept of API testing might seem daunting. It's easy to get lost in technical jargon and complex testing methodologies. However, the fundamental idea behind API testing is surprisingly straightforward: it's about verifying that your API endpoints behave as you intend them to. Think of it as asking simple questions about your API: "Does this endpoint return the correct data when I send a valid request?

", "What happens if I send incorrect data – does the API handle it gracefully and return an appropriate error?". These are the core questions API testing aims to answer. API testing for beginners doesn't need to be overly complicated.

The goal of this article is to demystify API testing in Python, specifically within the Django REST Framework ecosystem. We will focus on simple, practical strategies that you can immediately start applying to your projects, even if you are just beginning your journey with DRF. We'll break down the essential concepts, introduce beginner-friendly tools, and walk through concrete examples. Starting with basic techniques like manual testing with tools like curl or Postman, and progressing to using Django's built-in test client and DRF's APIClient, you'll gain a practical understanding of how to effectively test your APIs. The focus will be on building a solid foundation, ensuring you can confidently answer the crucial question: "Is my API working? ".

Understanding the Basics of API Testing

What is API Testing? A Definition for Python Developers

API testing, in the context of Python development and particularly with Django REST Framework, is the process of verifying that your application programming interfaces (APIs) are functioning correctly and reliably. An API acts as an intermediary, allowing different software systems to communicate and exchange data. In web development, APIs often expose data and functionality through HTTP endpoints, enabling client applications (like web browsers or mobile apps) to interact with a server-side application. For Python developers using DRF, API testing essentially means ensuring that your DRF views, serializers, and overall API logic are working as expected.

Unlike traditional web application testing, which often focuses on user interfaces and visual aspects, API testing operates at the message layer. Instead of interacting with a website through a browser, API tests send requests directly to your API endpoints and analyze the responses.

This involves verifying various aspects, such as the correctness of the data returned in the response body (often in JSON or XML format), the HTTP status codes returned (indicating success or failure), and the overall performance and security of the API. For instance, if you have an API endpoint designed to retrieve user details, API testing would involve sending a request to that endpoint and confirming that it returns the correct user information in the expected format, along with a successful HTTP status code like 200 OK. API testing is therefore critical for ensuring the backend logic of your DRF applications is robust and dependable.

Key Concepts in API Testing: Requests, Responses, and Status Codes

To effectively engage in API testing, understanding three core concepts is essential: requests, responses, and status codes. These are the building blocks of any interaction with an API and are central to formulating and interpreting API tests. A request is the message sent by a client (like a test script or a tool like Postman) to the API server.

This request typically includes information about what action the client wants to perform (e.g., retrieve data, create a new record, update an existing one) and any data necessary for that action. Common types of requests include GET (to retrieve data), POST (to create new data), PUT (to update existing data), and DELETE (to remove data). Each request is sent to a specific API endpoint, which is essentially a URL that identifies a particular resource or functionality exposed by the API.

The response is the message sent back by the API server to the client after processing the request. This response contains the outcome of the request, which could be the requested data, confirmation of an action, or an error message. Crucially, every response includes an HTTP status code, a three-digit number that indicates the general outcome of the request. Status codes are standardized, providing a consistent way to understand the result of an API call. For example, a status code of 200 OK signifies that the request was successful. A 400 Bad Request indicates that the client sent an invalid request, perhaps due to incorrect data format. A 401 Unauthorized status code means that authentication is required but was not provided or was invalid. A 500 Internal Server Error signals an error on the server side. In API testing, you not only verify the data in the response body but also critically examine the status code to ensure the API is behaving as expected under different conditions. Understanding these request-response cycles and HTTP status codes is fundamental to writing meaningful and effective API tests.

Essential Tools for API Testing in Python: A Beginner's Guide

For beginners venturing into API testing in Python, several tools can simplify the process and make it more accessible. Starting with manual testing, curl is a command-line tool that is invaluable for sending HTTP requests directly to your API endpoints. curl is pre-installed on most Unix-like systems (including macOS and Linux) and is readily available for Windows. It allows you to craft various types of HTTP requests (GET, POST, PUT, DELETE) and inspect the raw responses from your API. For instance, you can quickly test a GET endpoint by typing a simple command in your terminal, making it excellent for quick verification and understanding basic API interactions.

Moving towards GUI-based tools, Postman is an extremely popular and user-friendly application designed specifically for API testing. Postman provides a graphical interface to construct and send requests, view formatted responses (including JSON and XML), set headers, manage environments, and even save collections of requests for organized testing. For beginners, Postman's visual nature makes it easier to explore APIs, understand request structures, and analyze responses without needing to write code. While curl excels for quick, command-line checks, Postman offers a more comprehensive and visually intuitive experience, especially when dealing with more complex API interactions. As you progress, you will naturally transition to more programmatic approaches using Python itself. Django provides a built-in test client, which allows you to simulate HTTP requests within your Django test environment. Furthermore, Django REST Framework enhances this with its APIClient, which is specifically designed for testing DRF APIs, offering features tailored for testing serializers, viewsets, and authentication mechanisms. These Python-centric tools provide a more integrated and powerful way to automate your API tests as your testing needs become more sophisticated. Starting with curl and Postman provides a strong foundation before diving into programmatic testing with Django's test client and DRF's APIClient.

Simple API Testing Strategies for DRF

Strategy 1: Manual Testing with curl or Postman

How to Use curl for Basic API Endpoint Verification

curl is a powerful command-line tool that’s perfect for quickly verifying basic API endpoint functionality. To use curl for API testing, you'll primarily be sending HTTP requests and examining the responses directly in your terminal. Let's say you have a simple GET endpoint at http://localhost:8000/api/items/ that should return a list of items in JSON format. To test this with curl, you would open your terminal and type the following command:

curl http://localhost:8000/api/items/

After executing this command, curl will send a GET request to the specified URL, and the server's response will be printed directly in your terminal. You should see the JSON response body containing the list of items. To verify the HTTP status code, which is crucial for understanding the outcome of the request, you can add the -v (verbose) flag to your curl command:

curl -v http://localhost:8000/api/items/

This verbose mode provides more details, including the HTTP headers and the status code. Look for the line that starts with < HTTP/1.1 200 OK. 200 OK indicates a successful request. If you were expecting a different status code, or if you don't see a 200 OK for a successful GET request, it indicates a problem with your API endpoint. For POST requests, which are used to send data to the server (e.g., to create a new item), you would use the -X POST flag and provide the data using the -d flag, often in JSON format. For example, to create a new item, you might use:

curl -X POST -H "Content-Type: application/json" -d '{"name": "New Item", "description": "A test item"}' http://localhost:8000/api/items/

Here, -X POST specifies the POST method, -H "Content-Type: application/json" sets the content type of the request body to JSON, and -d '{"name": "New Item", "description": "A test item"}' provides the JSON data to be sent in the request body. By using curl in this way, you can manually test different API endpoints, verify status codes, and inspect response bodies, providing a fundamental level of API endpoint verification.

Exploring Postman: A GUI for API Testing

Postman provides a user-friendly graphical interface for API testing, making it exceptionally helpful for beginners and for more complex API interactions. Instead of typing commands in the terminal, Postman allows you to visually construct requests, inspect responses, and organize your tests. To start testing with Postman, download and install the application. Once opened, you’ll be greeted with a clean interface. To make your first API request, click the "+ New" button (often labeled as "New Request"). In the new request tab, you can select the HTTP method (GET, POST, PUT, DELETE, etc.) from a dropdown menu. Enter the API endpoint URL in the address bar. For example, if you want to test the same http://localhost:8000/api/items/ GET endpoint from the curl example, select "GET" and enter the URL.

Clicking the "Send" button will execute the request. Postman will then display the API response in a well-formatted manner below the request details. The response is typically divided into several sections: "Body" (showing the response data, often in JSON format), "Cookies", "Headers", and "Test Results". Crucially, Postman clearly displays the HTTP status code of the response, for instance, "200 OK" will be shown in green if the request is successful, making it immediately apparent whether the API responded as expected. For POST requests, or other requests that require a request body, Postman provides a "Body" tab where you can select the body type (e.g., raw, form-data, x-www-form-urlencoded) and enter the data. For JSON data, you would select raw and choose JSON from the dropdown, then type or paste your JSON payload. Postman also excels at managing API authentication. Under the "Authorization" tab, you can configure various authentication methods like Basic Auth, Bearer Token, or OAuth 2.0, simplifying the process of testing secured API endpoints. Beyond individual requests, Postman allows you to save requests into "Collections," which are essentially groups of API requests. Collections are incredibly useful for organizing your tests, running them sequentially, and even automating basic test workflows. Postman’s intuitive interface and rich feature set make it a valuable tool for both manual API exploration and more structured API testing strategies.

Strategy 2: Using Django's Test Client for API Tests

Setting Up Your Django Test Environment for API Testing

For more robust and automated API testing within your Django REST Framework projects, leveraging Django's built-in test client is essential. Django's test framework provides a controlled environment to execute tests and interact with your application code without affecting your live database or application state. Setting up your Django test environment primarily involves ensuring you have a tests.py file in your Django app directory. If you created your app using python manage.py startapp myapp, a tests.py file would have been automatically generated. Inside this file, you will write your test cases as Python classes that inherit from django.test.TestCase. Django automatically discovers and runs tests within your project when you execute the command python manage.py test.

Before running tests, Django sets up a test database. By default, it uses a separate, empty database to prevent your tests from modifying your development or production data. You can configure your test database settings in your project's settings.py file. It's generally recommended to use an in-memory SQLite database for testing, as it is fast and requires no external database server setup. You can achieve this by setting your DATABASES setting in settings.py like this:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'mydatabase.sqlite3', # or ':memory:' for in-memory
    }
}

To prepare your test environment for API testing, you often need to set up initial data, such as creating test users or populating your database with sample data that your API endpoints rely on. Django fixtures or data migrations can be used to set up this initial state. Within your test classes, you can use the setUp method to perform actions that need to be executed before each test method, such as creating users or setting up necessary objects. Once your tests.py file is in place and your test database configuration is set, you can run your tests by navigating to your project's root directory in the terminal and executing python manage.py test. Django will discover and run all tests within your project, providing feedback on the success or failure of each test case. This sets the stage for writing automated API tests using Django's test client.

Writing Your First API Test Case with Django's Test Client

With your Django test environment set up, you can start writing your first API test case using Django's test client. Within your tests.py file, create a test class that inherits from django.test.TestCase. Inside this class, define individual test methods, each prefixed with test_, to test specific aspects of your API endpoints. For example, let's say you want to test a GET endpoint at /api/items/ that should return a list of items. Your test class might look like this:

from django.test import TestCase
from django.urls import reverse

class ItemAPITest(TestCase):

    def test_get_item_list(self):
        response = self.client.get(reverse('item-list')) # Assuming your URL is named 'item-list'
        self.assertEqual(response.status_code, 200) # Assert that the status code is 200 OK
        # Further assertions to check the content of the response will be added later

In this example, self.client is an instance of Django's test client, which provides methods like get(), post(), put(), and delete() to simulate HTTP requests. reverse('item-list') is used to dynamically resolve the URL for your API endpoint based on its URL name (assuming you've named your URL pattern 'item-list' in your urls.py). The line self.assertEqual(response.status_code, 200) is an assertion that checks if the HTTP status code of the response is 200. Django's TestCase class provides various assertion methods (like assertEqual, assertContains, assertJSONEqual) to verify different aspects of your test results.

To test the content of the response, you might want to check if the response data is in JSON format and contains the expected items. You can access the JSON response data using response.json(). For instance, if you expect the API to return a list of items, you could add assertions like:

self.assertEqual(response.status_code, 200)
        self.assertEqual(response['content-type'], 'application/json') # Verify content type
        data = response.json()
        self.assertIsInstance(data, list) # Assert that the response data is a list
        # Further assertions to check the contents of the list

This basic example demonstrates how to use Django's test client to send a GET request to an API endpoint and assert the status code and response content type. You can expand on this by adding more test methods to cover different scenarios and using more specific assertions to thoroughly validate your API's behavior.

Assertions: Verifying API Response Data and Status Codes

Assertions are the heart of API testing; they are the checks you perform to verify that the API's behavior matches your expectations. Django's TestCase class, which you use to write your API tests, comes equipped with a rich set of assertion methods. These methods allow you to examine various aspects of the API response, such as the HTTP status code, the response headers, and the response body content. As you've seen in the previous example, self.assertEqual(response.status_code, 200) is a fundamental assertion to check if the status code is the expected value. Beyond status codes, you'll frequently want to verify the data returned in the API response body. For APIs that return JSON, response.json() parses the JSON response into a Python dictionary or list, making it easy to access and assert specific data points.

For instance, if your API endpoint should return a JSON response containing a user's name and email, you could use assertions like:

response = self.client.get(reverse('user-detail', kwargs={'pk': 1})) # Get details for user with ID 1
        self.assertEqual(response.status_code, 200)
        data = response.json()
        self.assertEqual(data['name'], 'Test User') # Assert user name
        self.assertEqual(data['email'], 'test@example.com') # Assert user email

In this example, self.assertEqual(data['name'], 'Test User') asserts that the 'name' field in the JSON response is equal to 'Test User'. Django also provides assertions specifically for JSON content, such as assertJSONEqual. assertJSONEqual is useful for comparing the entire JSON response to a known JSON string or Python dictionary. For example:

expected_json = {'name': 'Test User', 'email': 'test@example.com'}
        self.assertJSONEqual(response.content, expected_json) # Compare entire JSON response

Here, response.content gets the raw response content (as bytes), which assertJSONEqual then compares to the expected_json after converting both to JSON objects. Besides assertEqual and assertJSONEqual, other useful assertions include assertContains to check if a specific string is present in the response content (useful for non-JSON responses or error messages), assertNotEqual, assertTrue, assertFalse, assertIsInstance, and many more. Choosing the right assertions is key to writing effective API tests that thoroughly validate your API's behavior and catch potential issues. By combining status code assertions with data content assertions, you can build comprehensive test cases that ensure your APIs function correctly and reliably.

Strategy 3: Leveraging DRF's APIClient for Enhanced Testing

Understanding DRF's APIClient: A Powerful Testing Tool

While Django's test client provides a solid foundation for API testing, Django REST Framework (DRF) offers an enhanced test client called APIClient that is specifically designed for testing DRF APIs. APIClient builds upon Django's test client and adds features that are particularly useful when working with DRF's serializers, viewsets, and authentication mechanisms. One of the primary advantages of APIClient is its seamless handling of request and response formats commonly used in RESTful APIs, such as JSON. When you send requests using APIClient, it automatically formats the request data as JSON if you specify the format='json' argument. Similarly, when you receive responses, APIClient can automatically parse JSON responses, making it easier to work with JSON data in your tests.

To use APIClient, you first need to import it in your test file: from rest_framework.test import APIClient. Then, in your test class's setUp method or within individual test methods, you create an instance of APIClient: self.client = APIClient(). From this point, you can use methods like self.client.get(), self.client.post(), etc., just like with Django's test client. However, with APIClient, you can now easily send JSON data in your requests. For example, to send a POST request with JSON data to create a new item, you can do:

from rest_framework.test import APIClient
from django.test import TestCase
from django.urls import reverse

class ItemAPITest(TestCase):
    def setUp(self):
        self.client = APIClient()

    def test_create_item(self):
        data = {'name': 'Test Item', 'description': 'A new item for testing'}
        response = self.client.post(reverse('item-list'), data, format='json') # format='json' tells APIClient to send data as JSON
        self.assertEqual(response.status_code, 201) # 201 Created status for successful POST
        self.assertEqual(response.data['name'], 'Test Item') # Access response data directly as Python dict

In this example, format='json' in the post() method tells APIClient to serialize the data dictionary into JSON and set the Content-Type header to application/json. Furthermore, APIClient provides the response data as a Python dictionary via response.data, simplifying access to the JSON response body. This streamlined handling of JSON and other formats makes APIClient a more convenient and efficient tool for testing DRF APIs compared to Django's base test client, especially as your APIs become more complex and data-driven.

Authenticating API Requests in Your Tests with APIClient

Testing API endpoints that require authentication is a critical aspect of API testing, and DRF's APIClient provides straightforward ways to handle authentication in your tests. If your API uses token-based authentication, such as DRF's TokenAuthentication, you can easily set the authentication header for your test requests using APIClient. First, you need to create a user and generate an authentication token for that user within your test setup. Assuming you are using DRF's TokenAuthentication, you can create a token like this:

from rest_framework.test import APIClient
from django.test import TestCase
from django.contrib.auth.models import User
from rest_framework.authtoken.models import Token
from django.urls import reverse

class AuthenticatedItemAPITest(TestCase):
    def setUp(self):
        self.client = APIClient()
        self.user = User.objects.create_user(username='testuser', password='testpassword')
        self.token = Token.objects.create(user=self.user)
        self.api_endpoint = reverse('protected-item-list') # Assume this endpoint requires authentication

    def test_authenticated_access(self):
        self.client.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key) # Set authentication header
        response = self.client.get(self.api_endpoint)
        self.assertEqual(response.status_code, 200) # Expect 200 OK for authenticated access

    def test_unauthenticated_access_denied(self):
        response = self.client.get(self.api_endpoint)
        self.assertEqual(response.status_code, 401) # Expect 401 Unauthorized for unauthenticated access

In this example, self.client.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key) sets the Authorization header for subsequent requests made by self.client. The header value is formatted as Token <your_token_key>, which is the standard format for DRF's TokenAuthentication. After setting the credentials, any requests made using self.client within that test method will include this authentication header. This allows you to test endpoints that require authentication as if you were a logged-in user. If you are using other authentication schemes, such as session-based authentication or OAuth, APIClient provides similar mechanisms to set the appropriate authentication credentials for your test requests. For session-based authentication, you can use self.client.force_login(user=self.user) to simulate a logged-in user session. By leveraging these authentication features of APIClient, you can comprehensively test the security and access control of your DRF APIs.

Testing Serializers and Viewsets with DRF's APIClient

DRF's APIClient is particularly well-suited for testing serializers and viewsets, which are core components of DRF APIs. When testing serializers, you often want to verify that they correctly serialize Python objects into JSON or other formats and that they correctly deserialize incoming data, performing validation as expected. You can test serializers directly, independent of viewsets or API endpoints. For example, if you have a serializer named ItemSerializer, you can test its serialization like this:

from rest_framework.test import APIClient
from django.test import TestCase
from myapp.serializers import ItemSerializer
from myapp.models import Item

class SerializerTests(TestCase):

    def test_item_serializer_valid_serialization(self):
        item = Item.objects.create(name='Test Item', description='Serializer test item')
        serializer = ItemSerializer(item)
        expected_data = {'id': item.id, 'name': 'Test Item', 'description': 'Serializer test item'} # Expected serialized data
        self.assertEqual(serializer.data, expected_data) # Assert serialized data matches expectation

    def test_item_serializer_valid_deserialization(self):
        valid_data = {'name': 'Valid Item', 'description': 'Valid data for serializer'}
        serializer = ItemSerializer(data=valid_data) # Initialize serializer with data for deserialization
        self.assertTrue(serializer.is_valid()) # Assert data is valid
        item = serializer.save() # Save the deserialized data to create an Item instance
        self.assertEqual(item.name, 'Valid Item') # Assert saved item's name

In these serializer tests, you are directly instantiating the serializer and testing its data attribute for serialization and its is_valid() and save() methods for deserialization and validation. When testing viewsets, APIClient allows you to simulate requests to the viewset's API endpoints and verify the behavior of the viewset logic, including actions defined in your viewset (like list, create, retrieve, update, destroy). You can use APIClient to send requests to the URLs associated with your viewset actions and assert the responses. For example, to test the list action of an ItemViewSet, you would send a GET request to the list URL and assert the response status and data, as demonstrated in previous examples using APIClient to test API endpoints. By using APIClient in conjunction with direct serializer testing, you can achieve comprehensive testing of both the individual components (serializers) and the overall API logic (viewsets) in your DRF applications.

Practical Examples of API Testing in DRF

Example 1: Testing a Simple GET Endpoint

Creating a Basic API View and Serializer

Let's start with a practical example of testing a simple GET endpoint in DRF. First, we need to create a basic API view and serializer. Assume we want to create an endpoint that retrieves a list of Item objects. First, define a simple model in your models.py:

# myapp/models.py
from django.db import models

class Item(models.Model):
    name = models.CharField(max_length=100)
    description = models.TextField()

    def __str__(self):
        return self.name

Next, create a serializer for this model in serializers.py:

# myapp/serializers.py
from rest_framework import serializers
from .models import Item

class ItemSerializer(serializers.ModelSerializer):
    class Meta:
        model = Item
        fields = ['id', 'name', 'description']

Now, define a simple API view in views.py to retrieve a list of items:

# myapp/views.py
from rest_framework import generics
from .models import Item
from .serializers import ItemSerializer

class ItemListView(generics.ListAPIView):
    queryset = Item.objects.all()
    serializer_class = ItemSerializer

Finally, configure the URL in your urls.py:

# myapp/urls.py
from django.urls import path
from .views import ItemListView

urlpatterns = [
    path('items/', ItemListView.as_view(), name='item-list'),
]

This setup provides a basic GET endpoint at /api/items/ (assuming you've included your app's URLs in your project's main urls.py under /api/). This endpoint should return a list of Item objects serialized as JSON.

Writing a Test to Verify the GET Endpoint's Response

Now, let's write a test to verify this GET endpoint. In your tests.py, create a test class and a test method to test the ItemListView:

# myapp/tests.py
from rest_framework.test import APIClient
from django.test import TestCase
from django.urls import reverse
from .models import Item

class ItemListViewTest(TestCase):
    def setUp(self):
        self.client = APIClient()
        Item.objects.create(name='Item 1', description='Description 1')
        Item.objects.create(name='Item 2', description='Description 2')

    def test_get_item_list_api(self):
        url = reverse('item-list') # Get URL from URL name 'item-list'
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200) # Assert status code is 200 OK
        self.assertEqual(response['content-type'], 'application/json') # Assert content type is JSON
        data = response.json()
        self.assertEqual(len(data), 2) # Assert two items are returned
        self.assertEqual(data[0]['name'], 'Item 1') # Assert first item's name
        self.assertEqual(data[1]['description'], 'Description 2') # Assert second item's description

In this test, we first create two Item objects in the setUp method to ensure there is data to retrieve. Then, in test_get_item_list_api, we send a GET request to the item-list URL using APIClient. We assert that the status code is 200, the content type is JSON, and that the response data contains two items with the expected names and descriptions. This example demonstrates a basic yet complete test for a simple DRF GET endpoint.

Example 2: Testing a POST Endpoint with Data Validation

Implementing Data Validation in Your API View

Let's extend our example to include a POST endpoint with data validation. We'll create an endpoint to create new Item objects, but we'll enforce validation to ensure that the name field is always provided. Modify the ItemSerializer to include a validation rule:

# myapp/serializers.py
from rest_framework import serializers
from .models import Item

class ItemSerializer(serializers.ModelSerializer):
    class Meta:
        model = Item
        fields = ['id', 'name', 'description']

    def validate_name(self, value):
        if not value: # Ensure name is not empty
            raise serializers.ValidationError("Name cannot be blank.")
        return value

Now, create a view for handling POST requests to create new items. We'll use generics.CreateAPIView:

# myapp/views.py
from rest_framework import generics
from .models import Item
from .serializers import ItemSerializer

class ItemListView(generics.ListAPIView): # Keeping the ListAPIView from previous example
    queryset = Item.objects.all()
    serializer_class = ItemSerializer

class ItemCreateView(generics.CreateAPIView):
    queryset = Item.objects.all()
    serializer_class = ItemSerializer

Update your urls.py to include the POST endpoint:

# myapp/urls.py
from django.urls import path
from .views import ItemListView, ItemCreateView

urlpatterns = [
    path('items/', ItemListView.as_view(), name='item-list'), # GET endpoint remains
    path('items/create/', ItemCreateView.as_view(), name='item-create'), # POST endpoint for creation
]

Now, the /api/items/create/ endpoint accepts POST requests to create new Item objects, and the serializer will validate that the name field is provided.

Writing a Test to Ensure Data Validation Works Correctly

To test the data validation, we need to write test cases that send both valid and invalid data to the POST endpoint and verify that the API responds appropriately. Add the following test methods to your ItemListViewTest class in tests.py:

def test_create_item_valid_data(self):
        url = reverse('item-create')
        valid_data = {'name': 'Valid Item', 'description': 'Valid description'}
        response = self.client.post(url, valid_data, format='json')
        self.assertEqual(response.status_code, 201) # Assert 201 Created for valid data
        self.assertEqual(Item.objects.count(), 1) # Assert item is created in database
        self.assertEqual(Item.objects.first().name, 'Valid Item') # Assert created item's name

    def test_create_item_invalid_data(self):
        url = reverse('item-create')
        invalid_data = {'description': 'Missing name'} # Missing 'name' field - invalid
        response = self.client.post(url, invalid_data, format='json')
        self.assertEqual(response.status_code, 400) # Assert 400 Bad Request for invalid data
        self.assertEqual(Item.objects.count(), 0) # Assert no item is created
        self.assertIn('name', response.data) # Assert 'name' error is in response

In test_create_item_valid_data, we send valid data and assert that the status code is 201 (Created), that a new Item object is created in the database, and that its name is correct. In test_create_item_invalid_data, we send invalid data (missing the name field) and assert that the status code is 400 (Bad Request), that no new item is created, and that the response data contains an error message related to the 'name' field. These tests effectively validate the data validation logic implemented in the ItemSerializer and the POST endpoint.

Example 3: Testing Authentication and Permissions

Setting Up Authentication and Permissions in Your API

Let's add authentication and permissions to our API. We'll use DRF's TokenAuthentication and set permission to only allow authenticated users to create items. First, install djangorestframework-simplejwt if you haven't already ( pip install djangorestframework-simplejwt). Then, in your settings.py, add rest_framework.authtoken and rest_framework_simplejwt to INSTALLED_APPS and configure the default authentication and permission classes:

# settings.py
INSTALLED_APPS = [
    # ... other apps
    'rest_framework',
    'rest_framework.authtoken', # Enable TokenAuthentication
    'rest_framework_simplejwt',
    # ... your app
]

REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': [
        'rest_framework.authentication.TokenAuthentication', # Use TokenAuthentication by default
    ],
    'DEFAULT_PERMISSION_CLASSES': [
        'rest_framework.permissions.IsAuthenticated', # Require authentication for all views by default
    ]
}

Now, apply these permissions to the ItemCreateView. We'll also need to allow unauthenticated users to list items, so we'll adjust the permissions for ItemListView to allow any read requests but require authentication for write requests (though in this example, ItemListView is read-only). Modify your views as follows:

# myapp/views.py
from rest_framework import generics, permissions
from .models import Item
from .serializers import ItemSerializer

class ItemListView(generics.ListAPIView):
    queryset = Item.objects.all()
    serializer_class = ItemSerializer
    permission_classes = [permissions.AllowAny] # Allow anyone to list items

class ItemCreateView(generics.CreateAPIView):
    queryset = Item.objects.all()
    serializer_class = ItemSerializer
    permission_classes = [permissions.IsAuthenticated] # Require authentication to create items

With these changes, the ItemCreateView now requires authentication using TokenAuthentication, and only authenticated users will be allowed to create new items.

Writing Tests to Verify Authentication and Permission Requirements

Now, let's write tests to verify these authentication and permission requirements. We'll test that an authenticated user can successfully create an item and that an unauthenticated user is denied access. Add these test methods to your ItemListViewTest class:

def test_authenticated_user_can_create_item(self):
        url = reverse('item-create')
        user = User.objects.create_user(username='authuser', password='password123')
        token = Token.objects.create(user=user) # Generate token for the user
        self.client.credentials(HTTP_AUTHORIZATION='Token ' + token.key) # Set token in headers
        valid_data = {'name': 'Auth Item', 'description': 'Created by auth user'}
        response = self.client.post(url, valid_data, format='json')
        self.assertEqual(response.status_code, 201) # Assert 201 Created for authenticated user
        self.assertEqual(Item.objects.count(), 1) # Assert item created

    def test_unauthenticated_user_cannot_create_item(self):
        url = reverse('item-create')
        invalid_data = {'name': 'Unauth Item', 'description': 'Should fail'}
        response = self.client.post(url, invalid_data, format='json') # No authentication credentials
        self.assertEqual(response.status_code, 401) # Assert 401 Unauthorized for unauthenticated user
        self.assertEqual(Item.objects.count(), 0) # Assert no item is created

In test_authenticated_user_can_create_item, we create a user, generate a token for them, set the token in the Authorization header using self.client.credentials(), and then send a POST request. We assert that the status code is 201 and that an item is created. In test_unauthenticated_user_cannot_create_item, we send a POST request without any authentication credentials and assert that the status code is 401 (Unauthorized) and that no item is created. These tests effectively verify that authentication and permission settings are correctly enforced for the ItemCreateView.

Best Practices for API Testing in Python

Writing Clear and Concise API Tests

Writing clear and concise API tests is crucial for maintainability and understanding, especially as your project grows and your test suite expands. Well-written tests act as living documentation for your API, clearly demonstrating how each endpoint should behave. To achieve clarity, focus on making each test method test a single, specific aspect of your API endpoint.

Avoid combining multiple assertions within a single test method if they are testing different functionalities. Instead, break down complex test scenarios into smaller, more focused test methods. This makes it easier to pinpoint the exact cause of a test failure and understand the intended behavior of the API.

Use descriptive names for your test classes and test methods. Test class names should clearly indicate which API component they are testing (e.g., ItemListViewTest, UserSerializerTest). Test method names should describe the specific scenario being tested (e.g., test_get_item_list_api, test_create_item_valid_data, test_authenticated_user_can_create_item). Follow a consistent naming convention throughout your test suite. Within your test methods, keep the setup, action, and assertion steps distinct and easy to follow. Use comments sparingly, primarily to explain complex test logic or preconditions that are not immediately obvious from the code itself. Prioritize code readability and self-explanatory test structure over excessive commenting. For example, instead of writing a comment to explain an assertion, ensure the assertion method and its arguments clearly convey the expected outcome. By focusing on clarity and conciseness, you create a test suite that is not only effective at finding bugs but also serves as valuable documentation and a guide for understanding your API's behavior.

Keeping Your Tests Independent and Isolated

Maintaining independence and isolation among your API tests is a critical best practice to prevent test failures from cascading and to ensure that each test accurately reflects the behavior of the API component it is designed to test. Test independence means that each test should be able to run in isolation, without relying on the state or outcome of other tests. Avoid creating dependencies between tests, such as relying on the order in which tests are executed.

Django's test runner executes tests in an undefined order, so any test that depends on the execution of a previous test is inherently fragile. Each test should set up its own necessary preconditions and clean up after itself, ensuring a consistent and predictable test environment.

Test isolation primarily concerns database interactions. Each test should operate within its own transaction and rollback any database changes made during the test execution. Django's TestCase class automatically handles transaction management for you, wrapping each test method in a transaction and rolling it back after the test completes. This ensures that tests do not interfere with each other's database state and that the database is clean before and after each test. If you need to create data for a test, do so within the setUp method of your test class or directly within the test method itself. Avoid sharing test data or fixtures across multiple tests unless absolutely necessary and carefully manage the lifecycle of shared data. For example, if you are testing an API endpoint that relies on a specific user being present, create that user within the setUp method of the test class rather than assuming it was created by a previous test or an external setup process. By ensuring independence and isolation, you create a more robust and reliable test suite where test failures are more easily diagnosable and do not lead to false positives or cascading failures.

Automating Your API Tests with Continuous Integration (CI)

Automating your API tests with Continuous Integration (CI) is a crucial step towards building robust and reliable DRF applications. CI involves automatically running your test suite every time changes are made to your codebase, providing rapid feedback on whether those changes have introduced any regressions or broken existing functionality. Integrating API testing into your CI pipeline allows you to catch bugs early in the development process, before they reach production and impact users. Popular CI platforms like GitHub Actions, GitLab CI, Jenkins, and Travis CI can be easily configured to run your Django test suite automatically.

Typically, a CI workflow for API testing involves the following steps: When a developer pushes new code to a version control system (e.g., Git), the CI server detects the changes and automatically triggers a build process. The CI server checks out the latest version of the codebase, sets up the necessary environment (including Python and project dependencies), and creates a test database. The CI server then executes your Django test suite using python manage.py test. The test results are collected, and the CI server reports whether the tests passed or failed. If any tests fail, the CI server alerts the development team, providing details about the failed tests and allowing developers to quickly identify and fix the issues. Setting up CI for your API tests often involves creating a configuration file (e.g., .github/workflows/main.yml for GitHub Actions, .gitlab-ci.yml for GitLab CI) in your project repository that defines the CI workflow. This file specifies the steps to be executed by the CI server, including setting up Python, installing dependencies (using pip install -r requirements.txt), running database migrations ( python manage.py migrate), and executing the test command ( python manage.py test). Automating your API tests in a CI pipeline ensures that your API is continuously tested, providing confidence in the quality and reliability of your DRF applications.

Advanced API Testing Techniques (Beyond the Basics)

Introduction to Property-Based Testing for APIs

Beyond example-based testing, where you test specific inputs and expected outputs, property-based testing offers a powerful approach to API testing by focusing on testing general properties or invariants of your API. Instead of writing tests for specific scenarios, you define properties that should always hold true for your API, regardless of the input values. Property-based testing frameworks, like Hypothesis for Python, then automatically generate a wide range of input values and check if your defined properties hold for all of them. This can uncover edge cases and unexpected behaviors that might be missed by traditional example-based tests.

For example, consider an API endpoint that calculates the sum of two numbers. In example-based testing, you might test specific pairs of numbers like (2, 3) and (-5, 10). In property-based testing, you would define properties like "the sum of any two positive numbers should always be positive" or "addition should be commutative (a + b = b + a)".

Hypothesis would then generate numerous random positive numbers and negative numbers and automatically check if these properties hold true for your API's sum calculation. For API testing, properties could relate to data validation rules, consistency of data transformations, or adherence to API contracts.

For instance, you could define a property that "creating a new item via POST and then retrieving it via GET should always return the same item data". Property-based testing is particularly effective for testing complex API logic, data transformations, and edge cases, complementing example-based testing and providing a more robust and comprehensive testing strategy.

Exploring Contract Testing for API Integrations

When your DRF API interacts with other services or APIs, contract testing becomes essential to ensure seamless integration and prevent integration-related bugs. Contract testing focuses on verifying the "contract" between your API (the provider) and its consumers (other services or client applications). A contract defines the expected interactions between the provider and consumer, typically specifying the format of requests and responses, the data schemas, and the expected behavior for different scenarios.

Contract tests are written from the consumer's perspective, defining what the consumer expects from the provider API. These tests are then run against the provider API to verify that it fulfills the contract.

For example, if your DRF API provides user data to a frontend application, the contract might specify that the /users/{id} endpoint should return a JSON response with fields like name, email, and profile_picture_url. The frontend team would write contract tests based on these expectations. These tests would then be executed against your DRF API to confirm that it indeed returns responses that conform to the agreed-upon contract. Tools like Pact (for polyglot contract testing) and Spring Cloud Contract (for JVM-based applications) facilitate contract testing. In a Python context, Pact can be used to define contracts and verify API interactions. Contract testing helps ensure that API changes are backward-compatible and that integrations between services remain stable, reducing the risk of integration failures and broken dependencies. It promotes better collaboration between teams by explicitly defining and verifying API contracts.

Performance Testing Your DRF APIs

While functional API testing ensures that your API behaves correctly, performance testing is crucial to verify that your API can handle the expected load and perform efficiently under realistic conditions. Performance testing assesses aspects like response time, throughput, and resource utilization under varying load levels. It helps identify performance bottlenecks, scalability issues, and potential points of failure under stress. Different types of performance tests include load testing (simulating expected user load), stress testing (pushing the API beyond its limits to find breaking points), and soak testing (testing for extended periods to identify memory leaks or degradation over time).

Tools like Locust, Gatling, and JMeter are commonly used for performance testing APIs. Locust, for example, is a Python-based load testing tool that allows you to define user behavior in Python code and simulate a large number of concurrent users accessing your API. You can write Locust test scripts to simulate realistic user workflows, such as logging in, retrieving data, and submitting requests.

Performance testing should be conducted in a staging or production-like environment to accurately reflect real-world conditions. Regular performance testing as part of your CI/CD pipeline helps ensure that your DRF APIs are not only functionally correct but also performant and scalable, providing a good user experience and preventing performance-related outages under high load.

Troubleshooting Common API Testing Issues

Dealing with Authentication Errors in Your Tests

Authentication errors are common when setting up API tests, especially for endpoints that require authentication. A frequent issue is receiving 401 Unauthorized or 403 Forbidden status codes in your tests when you expect authenticated access. Double-check your authentication setup in your tests. Ensure you are correctly setting the authentication credentials using APIClient.credentials(). For token-based authentication, verify that you are generating a valid token for a test user and correctly including it in the Authorization header with the correct format (e.g., Token <your_token_key>). If you are using session-based authentication, ensure you are using APIClient.force_login(user=self.user) to simulate a logged-in user session.

Verify that your API endpoint is indeed configured to require the authentication method you are using in your tests. Check your view's authentication_classes and permission_classes settings in your DRF views or globally in your settings.py. Ensure that the authentication backend you are using in your tests (e.g., TokenAuthentication) matches the one configured for your API endpoint. Examine the response headers and body for more detailed error messages. Sometimes, the API response might provide additional information about why authentication failed, such as "Invalid token" or "Token expired". Use debugging tools or logging to inspect the request headers being sent by your test client to ensure the authentication headers are being included and formatted correctly. If you are still encountering issues, simplify your test case to the most basic authentication scenario and gradually add complexity to isolate the source of the error.

Handling Database Issues During Testing

Database issues can also be a source of problems in API testing. Tests might fail due to database connection errors, data inconsistencies, or unexpected database states. Ensure your test database configuration in settings.py is correctly set up. For speed and isolation, using an in-memory SQLite database ( 'NAME': ':memory:') is often recommended for testing. If you are using a different database backend for testing, verify that the database server is running and accessible. Database migrations are crucial for keeping your test database schema up-to-date. Before running your tests, ensure you have run python manage.py migrate in your test environment to apply any pending database migrations.

Data inconsistencies in tests can occur if tests are not properly isolated or if test data setup is not correctly managed. Remember that Django's TestCase rolls back database transactions after each test method, ensuring isolation. However, if you are using TransactionTestCase instead of TestCase or if you are performing database operations outside of the test transaction (e.g., using autocommit=True), you might encounter data inconsistencies between tests. Carefully review your test setup and data creation logic. Use setUp and tearDown methods to consistently set up and clean up test data. If your tests depend on specific database records, ensure those records are created within the test setup and not assumed to exist from previous tests or external sources. If you are still facing database issues, examine the test output and database server logs for any error messages or clues about the root cause of the problem.

Debugging Unexpected API Response Behavior

Sometimes, your API tests might fail with unexpected response behavior, such as incorrect status codes, unexpected response data, or missing data. When debugging such issues, start by examining the test output and the API response in detail. Look at the HTTP status code, response headers, and response body. Use print(response.content) or print(response.json()) in your test methods to inspect the raw response content and parsed JSON data. Compare the actual response to your expected response. Are the status codes different? Is the data in the response body missing, incorrect, or in the wrong format?

Use debugging tools to step through your API view code and serializer logic. Set breakpoints in your views, serializers, and any relevant middleware or authentication classes. Run your tests in debug mode (e.g., using python manage.py test --pdb) to step through the code execution and inspect variables at runtime. Examine the request data being received by your view and the data being serialized and returned in the response. Check for any exceptions or errors occurring during API processing. Django's debug toolbar can be invaluable for debugging API requests, providing detailed information about database queries, request parameters, and view processing time. Review your API view logic, serializer implementation, and URL configurations for any potential errors or misconfigurations. Sometimes, a simple typo in your view code or serializer logic can lead to unexpected API behavior. By systematically examining the response, debugging your code, and reviewing your API implementation, you can effectively troubleshoot and resolve unexpected API response behavior in your tests.

Conclusion: Mastering API Testing for Robust DRF Applications

The Importance of Continuous API Testing for Python Projects

Continuous API testing is not merely a recommended practice; it's an indispensable component of building robust and reliable Python projects, especially when leveraging Django REST Framework for API development. In today's software landscape, APIs are the backbone of most applications, enabling communication between different systems and services. Ensuring the stability and correctness of these APIs is paramount to the overall health and functionality of your applications.

Continuous API testing, integrated into your development workflow, provides a safety net, catching potential issues early in the development cycle, before they escalate into larger, more costly problems in production. By automating API tests and running them frequently, ideally with every code change, you gain rapid feedback on the impact of your modifications, allowing you to quickly identify and fix regressions.

Furthermore, continuous API testing fosters a culture of quality and reliability within your development team. It encourages developers to write testable code and to consider testing as an integral part of the development process, not just an afterthought. A comprehensive suite of API tests serves as living documentation for your API, clearly defining its expected behavior and providing a valuable resource for both current and future developers working on the project.

It also builds confidence in your API's stability, enabling faster development cycles and more frequent deployments, as you can be more certain that changes are not breaking existing functionality. In essence, embracing continuous API testing is a strategic investment that pays dividends in terms of reduced bug counts, improved application quality, faster development cycles, and enhanced team confidence in delivering reliable Python-based API solutions.

Resources for Further Learning on API Testing with Django REST Framework

To deepen your knowledge and skills in API testing with Django REST Framework, numerous resources are available for further learning. The official Django REST Framework documentation itself is an excellent starting point, providing comprehensive information on testing DRF APIs, including detailed guidance on using APIClient, writing test cases, and best practices. Specifically, explore the "Testing" section within the DRF documentation for in-depth coverage of testing serializers, views, and authentication. Numerous online tutorials and blog posts offer practical examples and step-by-step guides to API testing with DRF. Websites like MasterPythonNow (where this article is hosted!) often feature articles and tutorials on Python and Django development, including API testing topics. Search for tutorials specifically focusing on "DRF API testing," "Django REST Framework testing best practices," or "Python API testing tutorial" to find relevant content.

Books dedicated to Django and Django REST Framework development often include chapters or sections on testing APIs. Look for books that cover advanced testing techniques, such as property-based testing or contract testing, if you want to explore beyond basic example-based testing. Consider exploring testing libraries and frameworks beyond Django's built-in tools. Libraries like pytest offer a more flexible and feature-rich testing framework compared to Django's default test runner, and plugins like pytest-django integrate seamlessly with Django projects. For property-based testing, investigate Hypothesis, and for contract testing, explore Pact and its Python implementations. Engage with the Python and Django communities online. Forums, mailing lists, and online communities like Stack Overflow are valuable resources for asking questions, seeking advice, and learning from the experiences of other developers working with DRF API testing. By continuously exploring these resources and engaging with the community, you can significantly enhance your API testing expertise and build more robust DRF applications.

Next Steps: Improving Your API Testing Skills on MasterPythonNow.com

Now that you've gained a foundational understanding of API testing strategies for DRF beginners, the next step is to actively apply these techniques and continue honing your skills right here on MasterPythonNow.com. Start by implementing API tests for your own DRF projects, even for simple APIs. Begin with manual testing using curl and Postman to familiarize yourself with your API endpoints and responses. Then, transition to writing automated tests using Django's test client and DRF's APIClient. Focus on writing clear, concise, and independent test cases, following the best practices discussed in this article. Experiment with different assertion methods to thoroughly validate your API responses. Explore testing various aspects of your APIs, including data validation, authentication, and permissions.

As you become more comfortable with basic API testing, challenge yourself to explore more advanced techniques. Investigate property-based testing with Hypothesis to discover edge cases and improve the robustness of your API tests. Consider contract testing if your API integrates with other services to ensure seamless integrations and prevent breaking changes. Explore performance testing tools like Locust to assess the performance and scalability of your DRF APIs under load.

MasterPythonNow.com will continue to provide resources and tutorials to further guide your learning journey in API testing and Django REST Framework. Look out for future articles and tutorials that delve deeper into specific API testing topics, advanced techniques, and real-world examples. By consistently practicing, experimenting, and continuing to learn, you can master API testing for DRF and build truly robust and reliable Python-based API applications.

Frequently Asked Questions

What is API testing and why is it important?

API testing involves verifying that the application programming interfaces (APIs) of your software are functioning correctly. It's important because APIs are the backbone of modern applications, ensuring data exchange and integration between different systems.

What is DRF and how does it relate to API testing in Python?

DRF stands for Django REST Framework, a powerful toolkit for building Web APIs in Python. It simplifies API development, and therefore testing strategies must be adapted to its structure and features, such as serializers and viewsets.

What are some basic API testing strategies for beginners using Python?

Beginners should start with simple tests like checking status codes, validating response data formats, and verifying basic CRUD operations (Create, Read, Update, Delete) using tools like pytest and requests.

How can I automate API tests in Python?

Automation can be achieved using frameworks like pytest combined with libraries like requests. These allow you to write repeatable tests, making it easier to detect regressions and ensure API stability over time.

What are some common API testing pitfalls to avoid?

Common pitfalls include neglecting edge cases, ignoring security vulnerabilities (like authentication and authorization), and failing to properly validate error handling within the API responses.

Final Reflection: Ensuring API Reliability

The journey of building robust APIs doesn't end with deployment; it begins there. Ensuring consistent functionality through effective testing is paramount to maintaining trust and reliability in the digital landscape. The strategies outlined in this article, though simple, are the foundational building blocks for any Python developer venturing into the world of API development with Django REST Framework. Ignoring these principles is akin to building a house on sand – the inevitable collapse will be far more costly than the initial investment in solid foundations.

The impact of reliable APIs extends far beyond the code itself; it shapes user experiences, business partnerships, and the overall perception of your product. My own experience has shown me that even the smallest API glitch can have cascading effects, leading to frustration and lost opportunities. Quality is not an act, it is a habit. - Aristotle. This quote resonates deeply when considering API testing; it's not a one-time task, but a continuous commitment to excellence that ultimately defines the success of your application.

As you embark on your API development journey, remember that testing is not a burden, but an opportunity. Embrace these simple strategies, adapt them to your specific needs, and cultivate a culture of quality within your team. Let's strive to build APIs that not only function flawlessly but also inspire confidence and empower users to achieve their goals. The future of the web depends on reliable APIs, and that future starts with you.

Unleash Your API Potential: Test Like a Pro!

You've learned essential strategies to ensure your Django REST Framework APIs are reliable. Ready to put your knowledge into practice and build APIs with confidence? Here's how to get started:

  • Immediately apply at least one strategy from this article to your current DRF project. This is your first step!
  • Explore testing tools like Postman or Insomnia, comparing their features to those discussed here. Find the best fit for your workflow.
  • Share your experiences—successes and challenges—with other Python developers in the MasterPythonNow community forums. Let's learn and grow together!

Which API endpoint will you test first to ensure its reliability? Let us know in the comments!

Portrait of Ethan Caldwell

Ethan Caldwell

Ethan is a seasoned software engineer boasting over 15 years of dedicated experience in Python development. His career is marked by significant contributions to large-scale web applications, where he has honed his expertise in building robust and scalable systems. Beyond his professional achievements, Ethan is deeply passionate about education, particularly in making complex programming concepts accessible to learners. He excels at teaching through practical, real-world projects, ensuring students gain hands-on skills and a deep understanding of web development with Python. His areas of expertise are Web Development with Python and Python Basics.

Go up