Now, we will write a first round of unit tests. Specifically, we will write unit tests related to the LED resources. Create a new tests
subfolder within the virtual environment's root folder. Then, create a new test_hexacopter.py
file within the new tests
subfolder. Add the following lines that declare many import
statements and the TextHexacopter
class. The code file for the sample is included in the restful_python_chapter_10_02
folder:
import unittest import status import json from tornado import ioloop, escape from tornado.testing import AsyncHTTPTestCase, gen_test, gen from async_api import Application class TestHexacopter(AsyncHTTPTestCase): def get_app(self): self.app = Application(debug=False) return self.app def test_set_and_get_led_brightness_level(self): """ Ensure we can set and get the brightness levels for both LEDs """ patch_args_led_1 = {'brightness_level': 128} ...