chore: cleanup the unit tests with ddt

ddt stands for data-driven-tests, and it's also a Python module.
It adds the test data as a decorator to the test methods, so that
the test code can focus on each type of behaviors instead of using
`for` loops internally (on the other hand, you have to split big
tests which testing different types of behaviors into small tests).

Change-Id: I1cba67c15e9bb6e5e73e26a11e08fb1390a0504a
Merge "chore: cleanup the unit tests with ddt"