Now, we will write the first round of unit tests. Specifically, we will write unit tests related to the user and notification category resources: UserResource, UserListResource, NotificationCategoryResource, and NotificationCategoryListResource.
Create a new tests subfolder within the service folder. Then, create a new test_views.py file within the new service/tests subfolder. Add the following lines that declare many import statements and the first functions that we will use in many test functions. The code file for the sample is included in the restful_python_2_04_01 folder, in the Flask01/service/tests/test_views.py file:
import pytest from base64 import b64encode from flask import current_app, json, url_for from http_status import HttpStatus from models import orm, NotificationCategory, Notification, User TEST_USER_NAME = &apos...