Improving testing coverage

Now, we will write additional unit tests to improve the testing coverage. Specifically, we will write unit tests related to messages and users. Open the existing api/tests/ file and insert the following lines after the last line, within the InitialTests class. We need a new import statement and we will declare the new PlayerTests class. The code file for the sample is included in the restful_python_chapter_08_02 folder:

    def create_message(self, message, duration, category): url = url_for('api.messagelistresource', _external=True) data = {'message': message, 'duration': duration, 'category': category} response = url, headers=self.get_authentication_headers(self.test_user_name, self.test_user_password), ...

Get Building RESTful Python Web Services now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.